<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.20"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libxlsxwriter: workbook.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">libxlsxwriter
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.20 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_9a5cb1f80a06fe707e78a539c1c1dae8.html">xlsxwriter</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a> &#124;
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#define-members">Macros</a>  </div>
  <div class="headertitle">
<div class="title">workbook.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Description</h2>
<div class="textblock"><p>The Workbook is the main object exposed by the libxlsxwriter library. It represents the entire spreadsheet as you see it in Excel and internally it represents the Excel file as it is written on disk.</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include &quot;xlsxwriter.h&quot;</span></div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main() {</div>
<div class="line"> </div>
<div class="line">    <a class="code" href="structlxw__workbook.html">lxw_workbook</a>  *workbook  = <a class="code" href="workbook_8h.html#a1cf96608a23ee4eb0e8467c15240d00b">workbook_new</a>(<span class="stringliteral">&quot;filename.xlsx&quot;</span>);</div>
<div class="line">    <a class="code" href="structlxw__worksheet.html">lxw_worksheet</a> *worksheet = <a class="code" href="workbook_8h.html#a81d456b4f65a464e78e4a0030ecc3c2e">workbook_add_worksheet</a>(workbook, NULL);</div>
<div class="line"> </div>
<div class="line">    <a class="code" href="worksheet_8h.html#ac208046e7a6d12cc87982422efa41b31">worksheet_write_string</a>(worksheet, 0, 0, <span class="stringliteral">&quot;Hello Excel&quot;</span>, NULL);</div>
<div class="line"> </div>
<div class="line">    <span class="keywordflow">return</span> <a class="code" href="workbook_8h.html#ad9e7aeebc0fd43562db5bcd527b2ee5e">workbook_close</a>(workbook);</div>
<div class="line">}</div>
</div><!-- fragment --><div class="image">
<img src="workbook01.png" alt=""/>
</div>
 </div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a1cf96608a23ee4eb0e8467c15240d00b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structlxw__workbook.html">lxw_workbook</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workbook_8h.html#a1cf96608a23ee4eb0e8467c15240d00b">workbook_new</a> (const char *filename)</td></tr>
<tr class="memdesc:a1cf96608a23ee4eb0e8467c15240d00b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a new workbook object.  <a href="workbook_8h.html#a1cf96608a23ee4eb0e8467c15240d00b">More...</a><br /></td></tr>
<tr class="separator:a1cf96608a23ee4eb0e8467c15240d00b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8ca9bd8c30c618b81ca6180f78b03323"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structlxw__workbook.html">lxw_workbook</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workbook_8h.html#a8ca9bd8c30c618b81ca6180f78b03323">workbook_new_opt</a> (const char *filename, <a class="el" href="structlxw__workbook__options.html">lxw_workbook_options</a> *options)</td></tr>
<tr class="memdesc:a8ca9bd8c30c618b81ca6180f78b03323"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a new workbook object, and set the workbook options.  <a href="workbook_8h.html#a8ca9bd8c30c618b81ca6180f78b03323">More...</a><br /></td></tr>
<tr class="separator:a8ca9bd8c30c618b81ca6180f78b03323"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a81d456b4f65a464e78e4a0030ecc3c2e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structlxw__worksheet.html">lxw_worksheet</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workbook_8h.html#a81d456b4f65a464e78e4a0030ecc3c2e">workbook_add_worksheet</a> (<a class="el" href="structlxw__workbook.html">lxw_workbook</a> *workbook, const char *sheetname)</td></tr>
<tr class="memdesc:a81d456b4f65a464e78e4a0030ecc3c2e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a new worksheet to a workbook.  <a href="workbook_8h.html#a81d456b4f65a464e78e4a0030ecc3c2e">More...</a><br /></td></tr>
<tr class="separator:a81d456b4f65a464e78e4a0030ecc3c2e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9cb69c057990a4139f0a19b53b04b805"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structlxw__chartsheet.html">lxw_chartsheet</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workbook_8h.html#a9cb69c057990a4139f0a19b53b04b805">workbook_add_chartsheet</a> (<a class="el" href="structlxw__workbook.html">lxw_workbook</a> *workbook, const char *sheetname)</td></tr>
<tr class="memdesc:a9cb69c057990a4139f0a19b53b04b805"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a new chartsheet to a workbook.  <a href="workbook_8h.html#a9cb69c057990a4139f0a19b53b04b805">More...</a><br /></td></tr>
<tr class="separator:a9cb69c057990a4139f0a19b53b04b805"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a279a5d7075d09a3931aae9782afede33"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structlxw__format.html">lxw_format</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workbook_8h.html#a279a5d7075d09a3931aae9782afede33">workbook_add_format</a> (<a class="el" href="structlxw__workbook.html">lxw_workbook</a> *workbook)</td></tr>
<tr class="memdesc:a279a5d7075d09a3931aae9782afede33"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a new <a class="el" href="format_8h.html">Format</a> object to formats cells in worksheets.  <a href="workbook_8h.html#a279a5d7075d09a3931aae9782afede33">More...</a><br /></td></tr>
<tr class="separator:a279a5d7075d09a3931aae9782afede33"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a63b001ecefdbc4417986a3e344657726"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structlxw__chart.html">lxw_chart</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workbook_8h.html#a63b001ecefdbc4417986a3e344657726">workbook_add_chart</a> (<a class="el" href="structlxw__workbook.html">lxw_workbook</a> *workbook, uint8_t chart_type)</td></tr>
<tr class="memdesc:a63b001ecefdbc4417986a3e344657726"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a new chart to be added to a worksheet:  <a href="workbook_8h.html#a63b001ecefdbc4417986a3e344657726">More...</a><br /></td></tr>
<tr class="separator:a63b001ecefdbc4417986a3e344657726"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad9e7aeebc0fd43562db5bcd527b2ee5e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="common_8h.html#a04b59aa3c578bc75f88ac16a979c5fe6">lxw_error</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workbook_8h.html#ad9e7aeebc0fd43562db5bcd527b2ee5e">workbook_close</a> (<a class="el" href="structlxw__workbook.html">lxw_workbook</a> *workbook)</td></tr>
<tr class="memdesc:ad9e7aeebc0fd43562db5bcd527b2ee5e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Close the Workbook object and write the XLSX file.  <a href="workbook_8h.html#ad9e7aeebc0fd43562db5bcd527b2ee5e">More...</a><br /></td></tr>
<tr class="separator:ad9e7aeebc0fd43562db5bcd527b2ee5e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa814fd7f8d2c3ce86a7aa5d5ed127000"><td class="memItemLeft" align="right" valign="top"><a class="el" href="common_8h.html#a04b59aa3c578bc75f88ac16a979c5fe6">lxw_error</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workbook_8h.html#aa814fd7f8d2c3ce86a7aa5d5ed127000">workbook_set_properties</a> (<a class="el" href="structlxw__workbook.html">lxw_workbook</a> *workbook, <a class="el" href="structlxw__doc__properties.html">lxw_doc_properties</a> *properties)</td></tr>
<tr class="memdesc:aa814fd7f8d2c3ce86a7aa5d5ed127000"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the document properties such as Title, Author etc.  <a href="workbook_8h.html#aa814fd7f8d2c3ce86a7aa5d5ed127000">More...</a><br /></td></tr>
<tr class="separator:aa814fd7f8d2c3ce86a7aa5d5ed127000"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a337caad1c1cb16fed505a180d77f20d3"><td class="memItemLeft" align="right" valign="top"><a class="el" href="common_8h.html#a04b59aa3c578bc75f88ac16a979c5fe6">lxw_error</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workbook_8h.html#a337caad1c1cb16fed505a180d77f20d3">workbook_set_custom_property_string</a> (<a class="el" href="structlxw__workbook.html">lxw_workbook</a> *workbook, const char *name, const char *value)</td></tr>
<tr class="memdesc:a337caad1c1cb16fed505a180d77f20d3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set a custom document text property.  <a href="workbook_8h.html#a337caad1c1cb16fed505a180d77f20d3">More...</a><br /></td></tr>
<tr class="separator:a337caad1c1cb16fed505a180d77f20d3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af2d8534bf9d58e48491a761228d31e14"><td class="memItemLeft" align="right" valign="top"><a class="el" href="common_8h.html#a04b59aa3c578bc75f88ac16a979c5fe6">lxw_error</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workbook_8h.html#af2d8534bf9d58e48491a761228d31e14">workbook_set_custom_property_number</a> (<a class="el" href="structlxw__workbook.html">lxw_workbook</a> *workbook, const char *name, double value)</td></tr>
<tr class="memdesc:af2d8534bf9d58e48491a761228d31e14"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set a custom document number property.  <a href="workbook_8h.html#af2d8534bf9d58e48491a761228d31e14">More...</a><br /></td></tr>
<tr class="separator:af2d8534bf9d58e48491a761228d31e14"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a929d2f7063651d872ccac14180e042a4"><td class="memItemLeft" align="right" valign="top"><a class="el" href="common_8h.html#a04b59aa3c578bc75f88ac16a979c5fe6">lxw_error</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workbook_8h.html#a929d2f7063651d872ccac14180e042a4">workbook_set_custom_property_boolean</a> (<a class="el" href="structlxw__workbook.html">lxw_workbook</a> *workbook, const char *name, uint8_t value)</td></tr>
<tr class="memdesc:a929d2f7063651d872ccac14180e042a4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set a custom document boolean property.  <a href="workbook_8h.html#a929d2f7063651d872ccac14180e042a4">More...</a><br /></td></tr>
<tr class="separator:a929d2f7063651d872ccac14180e042a4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a843f0d1132a7eb3f8e3e9518ff27e5c9"><td class="memItemLeft" align="right" valign="top"><a class="el" href="common_8h.html#a04b59aa3c578bc75f88ac16a979c5fe6">lxw_error</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workbook_8h.html#a843f0d1132a7eb3f8e3e9518ff27e5c9">workbook_set_custom_property_datetime</a> (<a class="el" href="structlxw__workbook.html">lxw_workbook</a> *workbook, const char *name, <a class="el" href="structlxw__datetime.html">lxw_datetime</a> *datetime)</td></tr>
<tr class="memdesc:a843f0d1132a7eb3f8e3e9518ff27e5c9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set a custom document date or time property.  <a href="workbook_8h.html#a843f0d1132a7eb3f8e3e9518ff27e5c9">More...</a><br /></td></tr>
<tr class="separator:a843f0d1132a7eb3f8e3e9518ff27e5c9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a442b4056e8d4debf56c07888f2a776f6"><td class="memItemLeft" align="right" valign="top"><a class="el" href="common_8h.html#a04b59aa3c578bc75f88ac16a979c5fe6">lxw_error</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workbook_8h.html#a442b4056e8d4debf56c07888f2a776f6">workbook_define_name</a> (<a class="el" href="structlxw__workbook.html">lxw_workbook</a> *workbook, const char *name, const char *formula)</td></tr>
<tr class="memdesc:a442b4056e8d4debf56c07888f2a776f6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a defined name in the workbook to use as a variable.  <a href="workbook_8h.html#a442b4056e8d4debf56c07888f2a776f6">More...</a><br /></td></tr>
<tr class="separator:a442b4056e8d4debf56c07888f2a776f6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abd18b07856137e94b34c9aca7e0831b5"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structlxw__format.html">lxw_format</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workbook_8h.html#abd18b07856137e94b34c9aca7e0831b5">workbook_get_default_url_format</a> (<a class="el" href="structlxw__workbook.html">lxw_workbook</a> *workbook)</td></tr>
<tr class="memdesc:abd18b07856137e94b34c9aca7e0831b5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the default URL format used with <code><a class="el" href="worksheet_8h.html#a9b2ac96ee23574a432f5703eedcaf9a1">worksheet_write_url()</a></code>.  <a href="workbook_8h.html#abd18b07856137e94b34c9aca7e0831b5">More...</a><br /></td></tr>
<tr class="separator:abd18b07856137e94b34c9aca7e0831b5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a857f1d02d04a7d5a039642abde91c280"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structlxw__worksheet.html">lxw_worksheet</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workbook_8h.html#a857f1d02d04a7d5a039642abde91c280">workbook_get_worksheet_by_name</a> (<a class="el" href="structlxw__workbook.html">lxw_workbook</a> *workbook, const char *name)</td></tr>
<tr class="memdesc:a857f1d02d04a7d5a039642abde91c280"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get a worksheet object from its name.  <a href="workbook_8h.html#a857f1d02d04a7d5a039642abde91c280">More...</a><br /></td></tr>
<tr class="separator:a857f1d02d04a7d5a039642abde91c280"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aaf401cf363d4e497ca72dba14d53af42"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structlxw__chartsheet.html">lxw_chartsheet</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workbook_8h.html#aaf401cf363d4e497ca72dba14d53af42">workbook_get_chartsheet_by_name</a> (<a class="el" href="structlxw__workbook.html">lxw_workbook</a> *workbook, const char *name)</td></tr>
<tr class="memdesc:aaf401cf363d4e497ca72dba14d53af42"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get a chartsheet object from its name.  <a href="workbook_8h.html#aaf401cf363d4e497ca72dba14d53af42">More...</a><br /></td></tr>
<tr class="separator:aaf401cf363d4e497ca72dba14d53af42"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9ecbd616a8306c88210794140c434031"><td class="memItemLeft" align="right" valign="top"><a class="el" href="common_8h.html#a04b59aa3c578bc75f88ac16a979c5fe6">lxw_error</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workbook_8h.html#a9ecbd616a8306c88210794140c434031">workbook_validate_sheet_name</a> (<a class="el" href="structlxw__workbook.html">lxw_workbook</a> *workbook, const char *sheetname)</td></tr>
<tr class="memdesc:a9ecbd616a8306c88210794140c434031"><td class="mdescLeft">&#160;</td><td class="mdescRight">Validate a worksheet or chartsheet name.  <a href="workbook_8h.html#a9ecbd616a8306c88210794140c434031">More...</a><br /></td></tr>
<tr class="separator:a9ecbd616a8306c88210794140c434031"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8de478eed94be65de0622c64a0179ff9"><td class="memItemLeft" align="right" valign="top"><a class="el" href="common_8h.html#a04b59aa3c578bc75f88ac16a979c5fe6">lxw_error</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workbook_8h.html#a8de478eed94be65de0622c64a0179ff9">workbook_add_vba_project</a> (<a class="el" href="structlxw__workbook.html">lxw_workbook</a> *workbook, const char *filename)</td></tr>
<tr class="memdesc:a8de478eed94be65de0622c64a0179ff9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a vbaProject binary to the Excel workbook.  <a href="workbook_8h.html#a8de478eed94be65de0622c64a0179ff9">More...</a><br /></td></tr>
<tr class="separator:a8de478eed94be65de0622c64a0179ff9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a24dd6624ffdc3e17aa5bcfb4608755b8"><td class="memItemLeft" align="right" valign="top"><a class="el" href="common_8h.html#a04b59aa3c578bc75f88ac16a979c5fe6">lxw_error</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workbook_8h.html#a24dd6624ffdc3e17aa5bcfb4608755b8">workbook_set_vba_name</a> (<a class="el" href="structlxw__workbook.html">lxw_workbook</a> *workbook, const char *name)</td></tr>
<tr class="memdesc:a24dd6624ffdc3e17aa5bcfb4608755b8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the VBA name for the workbook.  <a href="workbook_8h.html#a24dd6624ffdc3e17aa5bcfb4608755b8">More...</a><br /></td></tr>
<tr class="separator:a24dd6624ffdc3e17aa5bcfb4608755b8"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="a1cf96608a23ee4eb0e8467c15240d00b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1cf96608a23ee4eb0e8467c15240d00b">&#9670;&nbsp;</a></span>workbook_new()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structlxw__workbook.html">lxw_workbook</a>* workbook_new </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>filename</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">filename</td><td>The name of the new Excel file to create.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A <a class="el" href="structlxw__workbook.html" title="Struct to represent an Excel workbook.">lxw_workbook</a> instance.</dd></dl>
<p>The <code>workbook_new()</code> constructor is used to create a new Excel workbook with a given filename:</p>
<div class="fragment"><div class="line"><a class="code" href="structlxw__workbook.html">lxw_workbook</a> *workbook  = <a class="code" href="workbook_8h.html#a1cf96608a23ee4eb0e8467c15240d00b">workbook_new</a>(<span class="stringliteral">&quot;filename.xlsx&quot;</span>);</div>
</div><!-- fragment --><p>When specifying a filename it is recommended that you use an <code>.xlsx</code> extension or Excel will generate a warning when opening the file. </p>
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="anatomy_8c-example.html#a1">anatomy.c</a>, <a class="el" href="array_formula_8c-example.html#a1">array_formula.c</a>, <a class="el" href="autofilter_8c-example.html#a1">autofilter.c</a>, <a class="el" href="chart_8c-example.html#a3">chart.c</a>, <a class="el" href="chart_area_8c-example.html#a6">chart_area.c</a>, <a class="el" href="chart_bar_8c-example.html#a6">chart_bar.c</a>, <a class="el" href="chart_clustered_8c-example.html#a5">chart_clustered.c</a>, <a class="el" href="chart_column_8c-example.html#a6">chart_column.c</a>, <a class="el" href="chart_data_labels_8c-example.html#a1">chart_data_labels.c</a>, <a class="el" href="chart_data_table_8c-example.html#a6">chart_data_table.c</a>, <a class="el" href="chart_data_tools_8c-example.html#a6">chart_data_tools.c</a>, <a class="el" href="chart_doughnut_8c-example.html#a6">chart_doughnut.c</a>, <a class="el" href="chart_fonts_8c-example.html#a1">chart_fonts.c</a>, <a class="el" href="chart_line_8c-example.html#a6">chart_line.c</a>, <a class="el" href="chart_pattern_8c-example.html#a1">chart_pattern.c</a>, <a class="el" href="chart_pie_8c-example.html#a6">chart_pie.c</a>, <a class="el" href="chart_radar_8c-example.html#a6">chart_radar.c</a>, <a class="el" href="chart_scatter_8c-example.html#a6">chart_scatter.c</a>, <a class="el" href="chart_styles_8c-example.html#a7">chart_styles.c</a>, <a class="el" href="chartsheet_8c-example.html#a6">chartsheet.c</a>, <a class="el" href="comments1_8c-example.html#a1">comments1.c</a>, <a class="el" href="comments2_8c-example.html#a1">comments2.c</a>, <a class="el" href="conditional_format1_8c-example.html#a1">conditional_format1.c</a>, <a class="el" href="conditional_format2_8c-example.html#a4">conditional_format2.c</a>, <a class="el" href="data_validate_8c-example.html#a7">data_validate.c</a>, <a class="el" href="dates_and_times01_8c-example.html#a1">dates_and_times01.c</a>, <a class="el" href="dates_and_times02_8c-example.html#a2">dates_and_times02.c</a>, <a class="el" href="dates_and_times03_8c-example.html#a2">dates_and_times03.c</a>, <a class="el" href="defined_name_8c-example.html#a1">defined_name.c</a>, <a class="el" href="demo_8c-example.html#a1">demo.c</a>, <a class="el" href="diagonal_border_8c-example.html#a1">diagonal_border.c</a>, <a class="el" href="doc_custom_properties_8c-example.html#a1">doc_custom_properties.c</a>, <a class="el" href="doc_properties_8c-example.html#a1">doc_properties.c</a>, <a class="el" href="format_font_8c-example.html#a1">format_font.c</a>, <a class="el" href="format_num_format_8c-example.html#a1">format_num_format.c</a>, <a class="el" href="headers_footers_8c-example.html#a1">headers_footers.c</a>, <a class="el" href="hello_8c-example.html#a1">hello.c</a>, <a class="el" href="hide_row_col_8c-example.html#a1">hide_row_col.c</a>, <a class="el" href="hide_sheet_8c-example.html#a1">hide_sheet.c</a>, <a class="el" href="hyperlinks_8c-example.html#a1">hyperlinks.c</a>, <a class="el" href="ignore_errors_8c-example.html#a1">ignore_errors.c</a>, <a class="el" href="image_buffer_8c-example.html#a1">image_buffer.c</a>, <a class="el" href="images_8c-example.html#a1">images.c</a>, <a class="el" href="macro_8c-example.html#a1">macro.c</a>, <a class="el" href="merge_range_8c-example.html#a1">merge_range.c</a>, <a class="el" href="merge_rich_string_8c-example.html#a1">merge_rich_string.c</a>, <a class="el" href="outline_8c-example.html#a1">outline.c</a>, <a class="el" href="outline_collapsed_8c-example.html#a9">outline_collapsed.c</a>, <a class="el" href="panes_8c-example.html#a1">panes.c</a>, <a class="el" href="rich_strings_8c-example.html#a1">rich_strings.c</a>, <a class="el" href="tab_colors_8c-example.html#a1">tab_colors.c</a>, <a class="el" href="tutorial1_8c-example.html#a1">tutorial1.c</a>, <a class="el" href="tutorial2_8c-example.html#a1">tutorial2.c</a>, <a class="el" href="tutorial3_8c-example.html#a3">tutorial3.c</a>, <a class="el" href="utf8_8c-example.html#a1">utf8.c</a>, and <a class="el" href="worksheet_protection_8c-example.html#a1">worksheet_protection.c</a>.</dd>
</dl>

</div>
</div>
<a id="a8ca9bd8c30c618b81ca6180f78b03323"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8ca9bd8c30c618b81ca6180f78b03323">&#9670;&nbsp;</a></span>workbook_new_opt()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structlxw__workbook.html">lxw_workbook</a>* workbook_new_opt </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>filename</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structlxw__workbook__options.html">lxw_workbook_options</a> *&#160;</td>
          <td class="paramname"><em>options</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">filename</td><td>The name of the new Excel file to create. </td></tr>
    <tr><td class="paramname">options</td><td>Workbook options.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A <a class="el" href="structlxw__workbook.html" title="Struct to represent an Excel workbook.">lxw_workbook</a> instance.</dd></dl>
<p>This function is the same as the <code><a class="el" href="workbook_8h.html#a1cf96608a23ee4eb0e8467c15240d00b" title="Create a new workbook object.">workbook_new()</a></code> constructor but allows additional options to be set.</p>
<div class="fragment"><div class="line"><a class="code" href="structlxw__workbook__options.html">lxw_workbook_options</a> options = {.<a class="code" href="structlxw__workbook__options.html#aa03636857813ca881bdd09e07bcbe738">constant_memory</a> = <a class="code" href="common_8h.html#a57bffaf0ff3cb4e9f4f7f2b0b6dad349a7850bcc34c18efe2e45372f4069be0bf">LXW_TRUE</a>,</div>
<div class="line">                                .tmpdir = <span class="stringliteral">&quot;C:\\Temp&quot;</span>,</div>
<div class="line">                                .use_zip64 = <a class="code" href="common_8h.html#a57bffaf0ff3cb4e9f4f7f2b0b6dad349a847f574cc183a1d8a4e3800fe28091f4">LXW_FALSE</a>};</div>
<div class="line"> </div>
<div class="line"><a class="code" href="structlxw__workbook.html">lxw_workbook</a>  *workbook  = <a class="code" href="workbook_8h.html#a8ca9bd8c30c618b81ca6180f78b03323">workbook_new_opt</a>(<span class="stringliteral">&quot;filename.xlsx&quot;</span>, &amp;options);</div>
</div><!-- fragment --><p>The options that can be set via <a class="el" href="structlxw__workbook__options.html" title="Workbook options.">lxw_workbook_options</a> are:</p>
<ul>
<li><code>constant_memory</code>: This option reduces the amount of data stored in memory so that large files can be written efficiently. This option is off by default. See the note below for limitations when this mode is on.</li>
<li><code>tmpdir</code>: libxlsxwriter stores workbook data in temporary files prior to assembling the final XLSX file. The temporary files are created in the system's temp directory. If the default temporary directory isn't accessible to your application, or doesn't contain enough space, you can specify an alternative location using the <code>tmpdir</code> option.</li>
<li><code>use_zip64</code>: Make the zip library use ZIP64 extensions when writing very large xlsx files to allow the zip container, or individual XML files within it, to be greater than 4 GB. See <a href="https://en.wikipedia.org/wiki/Zip_(file_format)#ZIP64">ZIP64 on Wikipedia</a> for more information. This option is off by default.</li>
</ul>
<dl class="section note"><dt>Note</dt><dd>In <code>constant_memory</code> mode a row of data is written and then discarded when a cell in a new row is added via one of the <code>worksheet_write_*()</code> functions. Therefore, once this option is active, data should be written in sequential row order. For this reason the <code><a class="el" href="worksheet_8h.html#ad5a2a09ec65c0f286b756235c7327225" title="Merge a range of cells.">worksheet_merge_range()</a></code> doesn't work in this mode. See also <a class="el" href="working_with_memory.html#ww_mem_constant">Constant Memory Mode</a>. </dd></dl>
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="constant_memory_8c-example.html#a5">constant_memory.c</a>.</dd>
</dl>

</div>
</div>
<a id="a81d456b4f65a464e78e4a0030ecc3c2e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a81d456b4f65a464e78e4a0030ecc3c2e">&#9670;&nbsp;</a></span>workbook_add_worksheet()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structlxw__worksheet.html">lxw_worksheet</a>* workbook_add_worksheet </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structlxw__workbook.html">lxw_workbook</a> *&#160;</td>
          <td class="paramname"><em>workbook</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>sheetname</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">workbook</td><td>Pointer to a <a class="el" href="structlxw__workbook.html" title="Struct to represent an Excel workbook.">lxw_workbook</a> instance. </td></tr>
    <tr><td class="paramname">sheetname</td><td>Optional worksheet name, defaults to Sheet1, etc.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A <a class="el" href="structlxw__worksheet.html" title="Struct to represent an Excel worksheet.">lxw_worksheet</a> object.</dd></dl>
<p>The <code>workbook_add_worksheet()</code> function adds a new worksheet to a workbook.</p>
<p>At least one worksheet should be added to a new workbook: The <a class="el" href="worksheet_8h.html">Worksheet</a> object is used to write data and configure a worksheet in the workbook.</p>
<p>The <code>sheetname</code> parameter is optional. If it is <code>NULL</code> the default Excel convention will be followed, i.e. Sheet1, Sheet2, etc.:</p>
<div class="fragment"><div class="line">worksheet = <a class="code" href="workbook_8h.html#a81d456b4f65a464e78e4a0030ecc3c2e">workbook_add_worksheet</a>(workbook, NULL  );     <span class="comment">// Sheet1</span></div>
<div class="line">worksheet = <a class="code" href="workbook_8h.html#a81d456b4f65a464e78e4a0030ecc3c2e">workbook_add_worksheet</a>(workbook, <span class="stringliteral">&quot;Foglio2&quot;</span>);  <span class="comment">// Foglio2</span></div>
<div class="line">worksheet = <a class="code" href="workbook_8h.html#a81d456b4f65a464e78e4a0030ecc3c2e">workbook_add_worksheet</a>(workbook, <span class="stringliteral">&quot;Data&quot;</span>);     <span class="comment">// Data</span></div>
<div class="line">worksheet = <a class="code" href="workbook_8h.html#a81d456b4f65a464e78e4a0030ecc3c2e">workbook_add_worksheet</a>(workbook, NULL  );     <span class="comment">// Sheet4</span></div>
</div><!-- fragment --><div class="image">
<img src="workbook02.png" alt=""/>
</div>
<p>The worksheet name must be a valid Excel worksheet name, i.e:</p>
<ul>
<li>The name is less than or equal to 31 UTF-8 characters.</li>
<li>The name doesn't contain any of the characters: <code>[ ] : * ? / \</code></li>
<li>The name doesn't start or end with an apostrophe.</li>
<li>The name isn't already in use. (Case insensitive).</li>
</ul>
<p>If any of these errors are encountered the function will return NULL. You can check for valid name using the <code><a class="el" href="workbook_8h.html#a9ecbd616a8306c88210794140c434031" title="Validate a worksheet or chartsheet name.">workbook_validate_sheet_name()</a></code> function.</p>
<dl class="section note"><dt>Note</dt><dd>You should also avoid using the worksheet name "History" (case insensitive) which is reserved in English language versions of Excel. Non-English versions may have restrictions on the equivalent word. </dd></dl>
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="anatomy_8c-example.html#a3">anatomy.c</a>, <a class="el" href="array_formula_8c-example.html#a3">array_formula.c</a>, <a class="el" href="autofilter_8c-example.html#a3">autofilter.c</a>, <a class="el" href="chart_8c-example.html#a4">chart.c</a>, <a class="el" href="chart_area_8c-example.html#a7">chart_area.c</a>, <a class="el" href="chart_bar_8c-example.html#a7">chart_bar.c</a>, <a class="el" href="chart_clustered_8c-example.html#a6">chart_clustered.c</a>, <a class="el" href="chart_column_8c-example.html#a7">chart_column.c</a>, <a class="el" href="chart_data_labels_8c-example.html#a3">chart_data_labels.c</a>, <a class="el" href="chart_data_table_8c-example.html#a7">chart_data_table.c</a>, <a class="el" href="chart_data_tools_8c-example.html#a7">chart_data_tools.c</a>, <a class="el" href="chart_doughnut_8c-example.html#a7">chart_doughnut.c</a>, <a class="el" href="chart_fonts_8c-example.html#a3">chart_fonts.c</a>, <a class="el" href="chart_line_8c-example.html#a7">chart_line.c</a>, <a class="el" href="chart_pattern_8c-example.html#a3">chart_pattern.c</a>, <a class="el" href="chart_pie_8c-example.html#a7">chart_pie.c</a>, <a class="el" href="chart_radar_8c-example.html#a7">chart_radar.c</a>, <a class="el" href="chart_scatter_8c-example.html#a7">chart_scatter.c</a>, <a class="el" href="chart_styles_8c-example.html#a8">chart_styles.c</a>, <a class="el" href="chartsheet_8c-example.html#a7">chartsheet.c</a>, <a class="el" href="comments1_8c-example.html#a3">comments1.c</a>, <a class="el" href="comments2_8c-example.html#a3">comments2.c</a>, <a class="el" href="conditional_format1_8c-example.html#a3">conditional_format1.c</a>, <a class="el" href="conditional_format2_8c-example.html#a5">conditional_format2.c</a>, <a class="el" href="constant_memory_8c-example.html#a7">constant_memory.c</a>, <a class="el" href="data_validate_8c-example.html#a8">data_validate.c</a>, <a class="el" href="dates_and_times01_8c-example.html#a3">dates_and_times01.c</a>, <a class="el" href="dates_and_times02_8c-example.html#a4">dates_and_times02.c</a>, <a class="el" href="dates_and_times03_8c-example.html#a4">dates_and_times03.c</a>, <a class="el" href="defined_name_8c-example.html#a3">defined_name.c</a>, <a class="el" href="demo_8c-example.html#a3">demo.c</a>, <a class="el" href="diagonal_border_8c-example.html#a3">diagonal_border.c</a>, <a class="el" href="doc_custom_properties_8c-example.html#a3">doc_custom_properties.c</a>, <a class="el" href="doc_properties_8c-example.html#a3">doc_properties.c</a>, <a class="el" href="format_font_8c-example.html#a3">format_font.c</a>, <a class="el" href="format_num_format_8c-example.html#a3">format_num_format.c</a>, <a class="el" href="headers_footers_8c-example.html#a3">headers_footers.c</a>, <a class="el" href="hello_8c-example.html#a3">hello.c</a>, <a class="el" href="hide_row_col_8c-example.html#a3">hide_row_col.c</a>, <a class="el" href="hide_sheet_8c-example.html#a3">hide_sheet.c</a>, <a class="el" href="hyperlinks_8c-example.html#a3">hyperlinks.c</a>, <a class="el" href="ignore_errors_8c-example.html#a3">ignore_errors.c</a>, <a class="el" href="image_buffer_8c-example.html#a3">image_buffer.c</a>, <a class="el" href="images_8c-example.html#a3">images.c</a>, <a class="el" href="macro_8c-example.html#a3">macro.c</a>, <a class="el" href="merge_range_8c-example.html#a3">merge_range.c</a>, <a class="el" href="merge_rich_string_8c-example.html#a3">merge_rich_string.c</a>, <a class="el" href="outline_8c-example.html#a3">outline.c</a>, <a class="el" href="outline_collapsed_8c-example.html#a10">outline_collapsed.c</a>, <a class="el" href="panes_8c-example.html#a3">panes.c</a>, <a class="el" href="rich_strings_8c-example.html#a3">rich_strings.c</a>, <a class="el" href="tab_colors_8c-example.html#a3">tab_colors.c</a>, <a class="el" href="tutorial1_8c-example.html#a3">tutorial1.c</a>, <a class="el" href="tutorial2_8c-example.html#a3">tutorial2.c</a>, <a class="el" href="tutorial3_8c-example.html#a5">tutorial3.c</a>, <a class="el" href="utf8_8c-example.html#a3">utf8.c</a>, and <a class="el" href="worksheet_protection_8c-example.html#a3">worksheet_protection.c</a>.</dd>
</dl>

</div>
</div>
<a id="a9cb69c057990a4139f0a19b53b04b805"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9cb69c057990a4139f0a19b53b04b805">&#9670;&nbsp;</a></span>workbook_add_chartsheet()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structlxw__chartsheet.html">lxw_chartsheet</a>* workbook_add_chartsheet </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structlxw__workbook.html">lxw_workbook</a> *&#160;</td>
          <td class="paramname"><em>workbook</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>sheetname</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">workbook</td><td>Pointer to a <a class="el" href="structlxw__workbook.html" title="Struct to represent an Excel workbook.">lxw_workbook</a> instance. </td></tr>
    <tr><td class="paramname">sheetname</td><td>Optional chartsheet name, defaults to Chart1, etc.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A <a class="el" href="structlxw__chartsheet.html" title="Struct to represent an Excel chartsheet.">lxw_chartsheet</a> object.</dd></dl>
<p>The <code>workbook_add_chartsheet()</code> function adds a new chartsheet to a workbook. The <a class="el" href="chartsheet_8h.html">Chartsheet</a> object is like a worksheet except it displays a chart instead of cell data.</p>
<div class="image">
<img src="chartsheet.png" alt=""/>
</div>
<p>The <code>sheetname</code> parameter is optional. If it is <code>NULL</code> the default Excel convention will be followed, i.e. Chart1, Chart2, etc.:</p>
<div class="fragment"><div class="line">chartsheet = <a class="code" href="workbook_8h.html#a9cb69c057990a4139f0a19b53b04b805">workbook_add_chartsheet</a>(workbook, NULL  );     <span class="comment">// Chart1</span></div>
<div class="line">chartsheet = <a class="code" href="workbook_8h.html#a9cb69c057990a4139f0a19b53b04b805">workbook_add_chartsheet</a>(workbook, <span class="stringliteral">&quot;My Chart&quot;</span>); <span class="comment">// My Chart</span></div>
<div class="line">chartsheet = <a class="code" href="workbook_8h.html#a9cb69c057990a4139f0a19b53b04b805">workbook_add_chartsheet</a>(workbook, NULL  );     <span class="comment">// Chart3</span></div>
</div><!-- fragment --><p>The chartsheet name must be a valid Excel worksheet name, i.e.:</p>
<ul>
<li>The name is less than or equal to 31 UTF-8 characters.</li>
<li>The name doesn't contain any of the characters: <code>[ ] : * ? / \</code></li>
<li>The name doesn't start or end with an apostrophe.</li>
<li>The name isn't already in use. (Case insensitive).</li>
</ul>
<p>If any of these errors are encountered the function will return NULL. You can check for valid name using the <code><a class="el" href="workbook_8h.html#a9ecbd616a8306c88210794140c434031" title="Validate a worksheet or chartsheet name.">workbook_validate_sheet_name()</a></code> function.</p>
<dl class="section note"><dt>Note</dt><dd>You should also avoid using the worksheet name "History" (case insensitive) which is reserved in English language versions of Excel. Non-English versions may have restrictions on the equivalent word.</dd></dl>
<p>At least one worksheet should be added to a new workbook when creating a chartsheet in order to provide data for the chart. The <a class="el" href="worksheet_8h.html">Worksheet</a> object is used to write data and configure a worksheet in the workbook. </p>
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="chartsheet_8c-example.html#a9">chartsheet.c</a>.</dd>
</dl>

</div>
</div>
<a id="a279a5d7075d09a3931aae9782afede33"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a279a5d7075d09a3931aae9782afede33">&#9670;&nbsp;</a></span>workbook_add_format()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structlxw__format.html">lxw_format</a>* workbook_add_format </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structlxw__workbook.html">lxw_workbook</a> *&#160;</td>
          <td class="paramname"><em>workbook</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">workbook</td><td>Pointer to a <a class="el" href="structlxw__workbook.html" title="Struct to represent an Excel workbook.">lxw_workbook</a> instance.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A <a class="el" href="structlxw__format.html" title="Struct to represent the formatting properties of an Excel format.">lxw_format</a> instance.</dd></dl>
<p>The <code><a class="el" href="workbook_8h.html#a279a5d7075d09a3931aae9782afede33" title="Create a new Format object to formats cells in worksheets.">workbook_add_format()</a></code> function can be used to create new <a class="el" href="format_8h.html">Format</a> objects which are used to apply formatting to a cell.</p>
<div class="fragment"><div class="line"><span class="comment">// Create the Format.</span></div>
<div class="line"><a class="code" href="structlxw__format.html">lxw_format</a> *format = <a class="code" href="workbook_8h.html#a279a5d7075d09a3931aae9782afede33">workbook_add_format</a>(workbook);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Set some of the format properties.</span></div>
<div class="line"><a class="code" href="format_8h.html#a85e1b0baf44b445b65894e48722aec14">format_set_bold</a>(format);</div>
<div class="line"><a class="code" href="format_8h.html#a61981b2080bfe6381ede5358ee05b05c">format_set_font_color</a>(format, <a class="code" href="format_8h.html#abeafc6e8222ba9fcfd4f2c2f4e9ea38baedd7412491d9f34fc5f947ada9d196ec">LXW_COLOR_RED</a>);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Use the format to change the text format in a cell.</span></div>
<div class="line"><a class="code" href="worksheet_8h.html#ac208046e7a6d12cc87982422efa41b31">worksheet_write_string</a>(worksheet, 0, 0, <span class="stringliteral">&quot;Hello&quot;</span>, format);</div>
</div><!-- fragment --><p>See <a class="el" href="format_8h.html">the Format object</a> and <a class="el" href="working_with_formats.html">Working with Formats</a> sections for more details about Format properties and how to set them. </p>
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="anatomy_8c-example.html#a5">anatomy.c</a>, <a class="el" href="chart_area_8c-example.html#a9">chart_area.c</a>, <a class="el" href="chart_bar_8c-example.html#a9">chart_bar.c</a>, <a class="el" href="chart_clustered_8c-example.html#a10">chart_clustered.c</a>, <a class="el" href="chart_column_8c-example.html#a9">chart_column.c</a>, <a class="el" href="chart_data_labels_8c-example.html#a5">chart_data_labels.c</a>, <a class="el" href="chart_data_table_8c-example.html#a9">chart_data_table.c</a>, <a class="el" href="chart_data_tools_8c-example.html#a9">chart_data_tools.c</a>, <a class="el" href="chart_doughnut_8c-example.html#a10">chart_doughnut.c</a>, <a class="el" href="chart_line_8c-example.html#a9">chart_line.c</a>, <a class="el" href="chart_pattern_8c-example.html#a6">chart_pattern.c</a>, <a class="el" href="chart_pie_8c-example.html#a10">chart_pie.c</a>, <a class="el" href="chart_radar_8c-example.html#a9">chart_radar.c</a>, <a class="el" href="chart_scatter_8c-example.html#a9">chart_scatter.c</a>, <a class="el" href="chartsheet_8c-example.html#a11">chartsheet.c</a>, <a class="el" href="comments2_8c-example.html#a5">comments2.c</a>, <a class="el" href="conditional_format1_8c-example.html#a7">conditional_format1.c</a>, <a class="el" href="conditional_format2_8c-example.html#a7">conditional_format2.c</a>, <a class="el" href="data_validate_8c-example.html#a10">data_validate.c</a>, <a class="el" href="dates_and_times01_8c-example.html#a5">dates_and_times01.c</a>, <a class="el" href="dates_and_times02_8c-example.html#a6">dates_and_times02.c</a>, <a class="el" href="dates_and_times03_8c-example.html#a6">dates_and_times03.c</a>, <a class="el" href="demo_8c-example.html#a5">demo.c</a>, <a class="el" href="diagonal_border_8c-example.html#a5">diagonal_border.c</a>, <a class="el" href="format_font_8c-example.html#a6">format_font.c</a>, <a class="el" href="format_num_format_8c-example.html#a6">format_num_format.c</a>, <a class="el" href="hyperlinks_8c-example.html#a6">hyperlinks.c</a>, <a class="el" href="merge_range_8c-example.html#a5">merge_range.c</a>, <a class="el" href="merge_rich_string_8c-example.html#a5">merge_rich_string.c</a>, <a class="el" href="outline_8c-example.html#a5">outline.c</a>, <a class="el" href="outline_collapsed_8c-example.html#a11">outline_collapsed.c</a>, <a class="el" href="panes_8c-example.html#a5">panes.c</a>, <a class="el" href="rich_strings_8c-example.html#a5">rich_strings.c</a>, <a class="el" href="tutorial2_8c-example.html#a5">tutorial2.c</a>, <a class="el" href="tutorial3_8c-example.html#a7">tutorial3.c</a>, and <a class="el" href="worksheet_protection_8c-example.html#a5">worksheet_protection.c</a>.</dd>
</dl>

</div>
</div>
<a id="a63b001ecefdbc4417986a3e344657726"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a63b001ecefdbc4417986a3e344657726">&#9670;&nbsp;</a></span>workbook_add_chart()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structlxw__chart.html">lxw_chart</a>* workbook_add_chart </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structlxw__workbook.html">lxw_workbook</a> *&#160;</td>
          <td class="paramname"><em>workbook</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>chart_type</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">workbook</td><td>Pointer to a <a class="el" href="structlxw__workbook.html" title="Struct to represent an Excel workbook.">lxw_workbook</a> instance. </td></tr>
    <tr><td class="paramname">chart_type</td><td>The type of chart to be created. See <a class="el" href="chart_8h.html#a8a438dba9506721060292a473daccbaf" title="Available chart types.">lxw_chart_type</a>.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A <a class="el" href="structlxw__chart.html" title="Struct to represent an Excel chart.">lxw_chart</a> object.</dd></dl>
<p>The <code>workbook_add_chart()</code> function creates a new chart object that can be added to a worksheet:</p>
<div class="fragment"><div class="line"><span class="comment">// Create a chart object.</span></div>
<div class="line"><a class="code" href="structlxw__chart.html">lxw_chart</a> *chart = <a class="code" href="workbook_8h.html#a63b001ecefdbc4417986a3e344657726">workbook_add_chart</a>(workbook, <a class="code" href="chart_8h.html#a9f577b0fcabe6cac9118a26a483fe85cafa7f69bde9c99b5818297c64e8b9070a">LXW_CHART_COLUMN</a>);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Add data series to the chart.</span></div>
<div class="line"><a class="code" href="chart_8h.html#ad60de0eb056e93435407e91482115f55">chart_add_series</a>(chart, NULL, <span class="stringliteral">&quot;Sheet1!$A$1:$A$5&quot;</span>);</div>
<div class="line"><a class="code" href="chart_8h.html#ad60de0eb056e93435407e91482115f55">chart_add_series</a>(chart, NULL, <span class="stringliteral">&quot;Sheet1!$B$1:$B$5&quot;</span>);</div>
<div class="line"><a class="code" href="chart_8h.html#ad60de0eb056e93435407e91482115f55">chart_add_series</a>(chart, NULL, <span class="stringliteral">&quot;Sheet1!$C$1:$C$5&quot;</span>);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Insert the chart into the worksheet</span></div>
<div class="line"><a class="code" href="worksheet_8h.html#ac2067faaacb8bfa6550b019e915900a2">worksheet_insert_chart</a>(worksheet, <a class="code" href="utility_8h.html#ad510ac6df573d23203374e24dba373d2">CELL</a>(<span class="stringliteral">&quot;B7&quot;</span>), chart);</div>
</div><!-- fragment --><p>The available chart types are defined in <a class="el" href="chart_8h.html#a8a438dba9506721060292a473daccbaf" title="Available chart types.">lxw_chart_type</a>. The types of charts that are supported are:</p>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadLeft">Chart type  </th><th class="markdownTableHeadLeft">Description   </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyLeft"><a class="el" href="chart_8h.html#a9f577b0fcabe6cac9118a26a483fe85cab7d204b0c88aa41565b792a3ac946e73">LXW_CHART_AREA</a>  </td><td class="markdownTableBodyLeft">Area chart.   </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyLeft"><a class="el" href="chart_8h.html#a9f577b0fcabe6cac9118a26a483fe85caf78202456c43feb53a91c2f56fd3341b">LXW_CHART_AREA_STACKED</a>  </td><td class="markdownTableBodyLeft">Area chart - stacked.   </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyLeft"><a class="el" href="chart_8h.html#a9f577b0fcabe6cac9118a26a483fe85ca9df7f4ab4ee2fc2e45937e3937046d17">LXW_CHART_AREA_STACKED_PERCENT</a>  </td><td class="markdownTableBodyLeft">Area chart - percentage stacked.   </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyLeft"><a class="el" href="chart_8h.html#a9f577b0fcabe6cac9118a26a483fe85cab70e5b5cf00126d7040ab25af3b117d5">LXW_CHART_BAR</a>  </td><td class="markdownTableBodyLeft">Bar chart.   </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyLeft"><a class="el" href="chart_8h.html#a9f577b0fcabe6cac9118a26a483fe85caa73fe9250d87a0b5c012d9861854285f">LXW_CHART_BAR_STACKED</a>  </td><td class="markdownTableBodyLeft">Bar chart - stacked.   </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyLeft"><a class="el" href="chart_8h.html#a9f577b0fcabe6cac9118a26a483fe85ca11e520d38ebd7c5a5710e60e8ffa5dbc">LXW_CHART_BAR_STACKED_PERCENT</a>  </td><td class="markdownTableBodyLeft">Bar chart - percentage stacked.   </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyLeft"><a class="el" href="chart_8h.html#a9f577b0fcabe6cac9118a26a483fe85cafa7f69bde9c99b5818297c64e8b9070a">LXW_CHART_COLUMN</a>  </td><td class="markdownTableBodyLeft">Column chart.   </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyLeft"><a class="el" href="chart_8h.html#a9f577b0fcabe6cac9118a26a483fe85ca1f3eecb6292871e7075c8227bee42a45">LXW_CHART_COLUMN_STACKED</a>  </td><td class="markdownTableBodyLeft">Column chart - stacked.   </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyLeft"><a class="el" href="chart_8h.html#a9f577b0fcabe6cac9118a26a483fe85ca05a44c21f8339df6c21a5dbf1d4aa611">LXW_CHART_COLUMN_STACKED_PERCENT</a>  </td><td class="markdownTableBodyLeft">Column chart - percentage stacked.   </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyLeft"><a class="el" href="chart_8h.html#a9f577b0fcabe6cac9118a26a483fe85cac6f314457fbc3aa1f7429aa34dd3e823">LXW_CHART_DOUGHNUT</a>  </td><td class="markdownTableBodyLeft">Doughnut chart.   </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyLeft"><a class="el" href="chart_8h.html#a9f577b0fcabe6cac9118a26a483fe85caf309b18af571c90d3ae052e769d30e6c">LXW_CHART_LINE</a>  </td><td class="markdownTableBodyLeft">Line chart.   </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyLeft"><a class="el" href="chart_8h.html#a9f577b0fcabe6cac9118a26a483fe85ca91abd3a3face03ed45f949c5073fcacf">LXW_CHART_LINE_STACKED</a>  </td><td class="markdownTableBodyLeft">Line chart - stacked.   </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyLeft"><a class="el" href="chart_8h.html#a9f577b0fcabe6cac9118a26a483fe85ca1fe7e2bcd7a70a760828ea37512ee264">LXW_CHART_LINE_STACKED_PERCENT</a>  </td><td class="markdownTableBodyLeft">Line chart - percentage stacked.   </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyLeft"><a class="el" href="chart_8h.html#a9f577b0fcabe6cac9118a26a483fe85ca679756788a8bec4bfc1e1c723ec5246a">LXW_CHART_PIE</a>  </td><td class="markdownTableBodyLeft">Pie chart.   </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyLeft"><a class="el" href="chart_8h.html#a9f577b0fcabe6cac9118a26a483fe85cac67f7cb8fb0cdd98b0e3d8ecd7c5cd4e">LXW_CHART_SCATTER</a>  </td><td class="markdownTableBodyLeft">Scatter chart.   </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyLeft"><a class="el" href="chart_8h.html#a9f577b0fcabe6cac9118a26a483fe85ca2c790940adb04ba5030a3fb1cf9a4c83">LXW_CHART_SCATTER_STRAIGHT</a>  </td><td class="markdownTableBodyLeft">Scatter chart - straight.   </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyLeft"><a class="el" href="chart_8h.html#a9f577b0fcabe6cac9118a26a483fe85ca4629ad350ebcdb6f98e1ce8b3c0bdcfa">LXW_CHART_SCATTER_STRAIGHT_WITH_MARKERS</a>  </td><td class="markdownTableBodyLeft">Scatter chart - straight with markers.   </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyLeft"><a class="el" href="chart_8h.html#a9f577b0fcabe6cac9118a26a483fe85cabc16d4ec606d150661855b2252565506">LXW_CHART_SCATTER_SMOOTH</a>  </td><td class="markdownTableBodyLeft">Scatter chart - smooth.   </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyLeft"><a class="el" href="chart_8h.html#a9f577b0fcabe6cac9118a26a483fe85ca50cf4163e4a7b146771ff7dd180ae4c1">LXW_CHART_SCATTER_SMOOTH_WITH_MARKERS</a>  </td><td class="markdownTableBodyLeft">Scatter chart - smooth with markers.   </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyLeft"><a class="el" href="chart_8h.html#a9f577b0fcabe6cac9118a26a483fe85ca700d2ed934b73997dc030c6f5f652b58">LXW_CHART_RADAR</a>  </td><td class="markdownTableBodyLeft">Radar chart.   </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyLeft"><a class="el" href="chart_8h.html#a9f577b0fcabe6cac9118a26a483fe85cae7bc22beb8b3f55a83f7ea8df896b595">LXW_CHART_RADAR_WITH_MARKERS</a>  </td><td class="markdownTableBodyLeft">Radar chart - with markers.   </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyLeft"><a class="el" href="chart_8h.html#a9f577b0fcabe6cac9118a26a483fe85ca10120027a87029da4cb9e66ecab5e22f">LXW_CHART_RADAR_FILLED</a>  </td><td class="markdownTableBodyLeft">Radar chart - filled.   </td></tr>
</table>
<p>See <a class="el" href="chart_8h.html">chart.h</a> for details. </p>
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="chart_8c-example.html#a6">chart.c</a>, <a class="el" href="chart_area_8c-example.html#a12">chart_area.c</a>, <a class="el" href="chart_bar_8c-example.html#a12">chart_bar.c</a>, <a class="el" href="chart_clustered_8c-example.html#a8">chart_clustered.c</a>, <a class="el" href="chart_column_8c-example.html#a12">chart_column.c</a>, <a class="el" href="chart_data_labels_8c-example.html#a12">chart_data_labels.c</a>, <a class="el" href="chart_data_table_8c-example.html#a12">chart_data_table.c</a>, <a class="el" href="chart_data_tools_8c-example.html#a12">chart_data_tools.c</a>, <a class="el" href="chart_doughnut_8c-example.html#a12">chart_doughnut.c</a>, <a class="el" href="chart_fonts_8c-example.html#a6">chart_fonts.c</a>, <a class="el" href="chart_line_8c-example.html#a12">chart_line.c</a>, <a class="el" href="chart_pattern_8c-example.html#a10">chart_pattern.c</a>, <a class="el" href="chart_pie_8c-example.html#a12">chart_pie.c</a>, <a class="el" href="chart_radar_8c-example.html#a12">chart_radar.c</a>, <a class="el" href="chart_scatter_8c-example.html#a12">chart_scatter.c</a>, <a class="el" href="chart_styles_8c-example.html#a10">chart_styles.c</a>, and <a class="el" href="chartsheet_8c-example.html#a14">chartsheet.c</a>.</dd>
</dl>

</div>
</div>
<a id="ad9e7aeebc0fd43562db5bcd527b2ee5e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad9e7aeebc0fd43562db5bcd527b2ee5e">&#9670;&nbsp;</a></span>workbook_close()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="common_8h.html#a04b59aa3c578bc75f88ac16a979c5fe6">lxw_error</a> workbook_close </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structlxw__workbook.html">lxw_workbook</a> *&#160;</td>
          <td class="paramname"><em>workbook</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">workbook</td><td>Pointer to a <a class="el" href="structlxw__workbook.html" title="Struct to represent an Excel workbook.">lxw_workbook</a> instance.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A <a class="el" href="common_8h.html#a96384aee66a82d783d695374078e1ea9" title="Error codes from libxlsxwriter functions.">lxw_error</a>.</dd></dl>
<p>The <code>workbook_close()</code> function closes a Workbook object, writes the Excel file to disk, frees any memory allocated internally to the Workbook and frees the object itself.</p>
<div class="fragment"><div class="line"><a class="code" href="workbook_8h.html#ad9e7aeebc0fd43562db5bcd527b2ee5e">workbook_close</a>(workbook);</div>
</div><!-- fragment --><p>The <code>workbook_close()</code> function returns any <a class="el" href="common_8h.html#a96384aee66a82d783d695374078e1ea9" title="Error codes from libxlsxwriter functions.">lxw_error</a> error codes encountered when creating the Excel file. The error code can be returned from the program main or the calling function:</p>
<div class="fragment"><div class="line"><span class="keywordflow">return</span> <a class="code" href="workbook_8h.html#ad9e7aeebc0fd43562db5bcd527b2ee5e">workbook_close</a>(workbook);</div>
</div><!-- fragment --> <dl class="section examples"><dt>Examples</dt><dd><a class="el" href="anatomy_8c-example.html#a11">anatomy.c</a>, <a class="el" href="array_formula_8c-example.html#a7">array_formula.c</a>, <a class="el" href="autofilter_8c-example.html#a7">autofilter.c</a>, <a class="el" href="chart_8c-example.html#a11">chart.c</a>, <a class="el" href="chart_area_8c-example.html#a27">chart_area.c</a>, <a class="el" href="chart_bar_8c-example.html#a27">chart_bar.c</a>, <a class="el" href="chart_clustered_8c-example.html#a18">chart_clustered.c</a>, <a class="el" href="chart_column_8c-example.html#a27">chart_column.c</a>, <a class="el" href="chart_data_labels_8c-example.html#a43">chart_data_labels.c</a>, <a class="el" href="chart_data_table_8c-example.html#a29">chart_data_table.c</a>, <a class="el" href="chart_data_tools_8c-example.html#a38">chart_data_tools.c</a>, <a class="el" href="chart_doughnut_8c-example.html#a26">chart_doughnut.c</a>, <a class="el" href="chart_fonts_8c-example.html#a28">chart_fonts.c</a>, <a class="el" href="chart_line_8c-example.html#a27">chart_line.c</a>, <a class="el" href="chart_pattern_8c-example.html#a30">chart_pattern.c</a>, <a class="el" href="chart_pie_8c-example.html#a25">chart_pie.c</a>, <a class="el" href="chart_radar_8c-example.html#a27">chart_radar.c</a>, <a class="el" href="chart_scatter_8c-example.html#a29">chart_scatter.c</a>, <a class="el" href="chart_styles_8c-example.html#a16">chart_styles.c</a>, <a class="el" href="chartsheet_8c-example.html#a28">chartsheet.c</a>, <a class="el" href="comments1_8c-example.html#a6">comments1.c</a>, <a class="el" href="comments2_8c-example.html#a28">comments2.c</a>, <a class="el" href="conditional_format1_8c-example.html#a19">conditional_format1.c</a>, <a class="el" href="conditional_format2_8c-example.html#a57">conditional_format2.c</a>, <a class="el" href="constant_memory_8c-example.html#a9">constant_memory.c</a>, <a class="el" href="data_validate_8c-example.html#a50">data_validate.c</a>, <a class="el" href="dates_and_times01_8c-example.html#a9">dates_and_times01.c</a>, <a class="el" href="dates_and_times02_8c-example.html#a10">dates_and_times02.c</a>, <a class="el" href="dates_and_times03_8c-example.html#a14">dates_and_times03.c</a>, <a class="el" href="defined_name_8c-example.html#a9">defined_name.c</a>, <a class="el" href="demo_8c-example.html#a11">demo.c</a>, <a class="el" href="diagonal_border_8c-example.html#a16">diagonal_border.c</a>, <a class="el" href="doc_custom_properties_8c-example.html#a11">doc_custom_properties.c</a>, <a class="el" href="doc_properties_8c-example.html#a9">doc_properties.c</a>, <a class="el" href="format_font_8c-example.html#a10">format_font.c</a>, <a class="el" href="format_num_format_8c-example.html#a9">format_num_format.c</a>, <a class="el" href="headers_footers_8c-example.html#a13">headers_footers.c</a>, <a class="el" href="hello_8c-example.html#a6">hello.c</a>, <a class="el" href="hide_row_col_8c-example.html#a12">hide_row_col.c</a>, <a class="el" href="hide_sheet_8c-example.html#a7">hide_sheet.c</a>, <a class="el" href="hyperlinks_8c-example.html#a14">hyperlinks.c</a>, <a class="el" href="ignore_errors_8c-example.html#a11">ignore_errors.c</a>, <a class="el" href="image_buffer_8c-example.html#a9">image_buffer.c</a>, <a class="el" href="images_8c-example.html#a14">images.c</a>, <a class="el" href="macro_8c-example.html#a6">macro.c</a>, <a class="el" href="merge_range_8c-example.html#a17">merge_range.c</a>, <a class="el" href="merge_rich_string_8c-example.html#a18">merge_rich_string.c</a>, <a class="el" href="outline_8c-example.html#a20">outline.c</a>, <a class="el" href="outline_collapsed_8c-example.html#a19">outline_collapsed.c</a>, <a class="el" href="panes_8c-example.html#a20">panes.c</a>, <a class="el" href="rich_strings_8c-example.html#a20">rich_strings.c</a>, <a class="el" href="tab_colors_8c-example.html#a8">tab_colors.c</a>, <a class="el" href="tutorial1_8c-example.html#a7">tutorial1.c</a>, <a class="el" href="tutorial2_8c-example.html#a11">tutorial2.c</a>, <a class="el" href="tutorial3_8c-example.html#a15">tutorial3.c</a>, <a class="el" href="utf8_8c-example.html#a5">utf8.c</a>, and <a class="el" href="worksheet_protection_8c-example.html#a12">worksheet_protection.c</a>.</dd>
</dl>

</div>
</div>
<a id="aa814fd7f8d2c3ce86a7aa5d5ed127000"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa814fd7f8d2c3ce86a7aa5d5ed127000">&#9670;&nbsp;</a></span>workbook_set_properties()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="common_8h.html#a04b59aa3c578bc75f88ac16a979c5fe6">lxw_error</a> workbook_set_properties </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structlxw__workbook.html">lxw_workbook</a> *&#160;</td>
          <td class="paramname"><em>workbook</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structlxw__doc__properties.html">lxw_doc_properties</a> *&#160;</td>
          <td class="paramname"><em>properties</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">workbook</td><td>Pointer to a <a class="el" href="structlxw__workbook.html" title="Struct to represent an Excel workbook.">lxw_workbook</a> instance. </td></tr>
    <tr><td class="paramname">properties</td><td>Document properties to set.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A <a class="el" href="common_8h.html#a96384aee66a82d783d695374078e1ea9" title="Error codes from libxlsxwriter functions.">lxw_error</a>.</dd></dl>
<p>The <code>workbook_set_properties</code> function can be used to set the document properties of the Excel file created by <code>libxlsxwriter</code>. These properties are visible when you use the <code>Office Button -&gt; Prepare -&gt; Properties</code> option in Excel and are also available to external applications that read or index windows files.</p>
<p>The properties that can be set are:</p>
<ul>
<li><code>title</code></li>
<li><code>subject</code></li>
<li><code>author</code></li>
<li><code>manager</code></li>
<li><code>company</code></li>
<li><code>category</code></li>
<li><code>keywords</code></li>
<li><code>comments</code></li>
<li><code>hyperlink_base</code></li>
<li><code>created</code></li>
</ul>
<p>The properties are specified via a <code><a class="el" href="structlxw__doc__properties.html">lxw_doc_properties</a></code> struct. All the fields are all optional. An example of how to create and pass the properties is:</p>
<div class="fragment"><div class="line"><span class="comment">// Create a properties structure and set some of the fields.</span></div>
<div class="line"><a class="code" href="structlxw__doc__properties.html">lxw_doc_properties</a> properties = {</div>
<div class="line">    .<a class="code" href="structlxw__doc__properties.html#a23d8fd5995ef26d1eab54c4dbd92393c">title</a>    = <span class="stringliteral">&quot;This is an example spreadsheet&quot;</span>,</div>
<div class="line">    .subject  = <span class="stringliteral">&quot;With document properties&quot;</span>,</div>
<div class="line">    .author   = <span class="stringliteral">&quot;John McNamara&quot;</span>,</div>
<div class="line">    .manager  = <span class="stringliteral">&quot;Dr. Heinz Doofenshmirtz&quot;</span>,</div>
<div class="line">    .company  = <span class="stringliteral">&quot;of Wolves&quot;</span>,</div>
<div class="line">    .category = <span class="stringliteral">&quot;Example spreadsheets&quot;</span>,</div>
<div class="line">    .keywords = <span class="stringliteral">&quot;Sample, Example, Properties&quot;</span>,</div>
<div class="line">    .comments = <span class="stringliteral">&quot;Created with libxlsxwriter&quot;</span>,</div>
<div class="line">    .status   = <span class="stringliteral">&quot;Quo&quot;</span>,</div>
<div class="line">};</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Set the properties in the workbook.</span></div>
<div class="line"><a class="code" href="workbook_8h.html#aa814fd7f8d2c3ce86a7aa5d5ed127000">workbook_set_properties</a>(workbook, &amp;properties);</div>
</div><!-- fragment --><div class="image">
<img src="doc_properties.png" alt=""/>
</div>
<p>The <code>created</code> parameter sets the file creation date/time shown in Excel. This defaults to the current time and date if set to 0. If you wish to create files that are binary equivalent (for the same input data) then you should set this creation date/time to a known value using a <code>time_t</code> value. </p>
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="doc_properties_8c-example.html#a6">doc_properties.c</a>.</dd>
</dl>

</div>
</div>
<a id="a337caad1c1cb16fed505a180d77f20d3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a337caad1c1cb16fed505a180d77f20d3">&#9670;&nbsp;</a></span>workbook_set_custom_property_string()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="common_8h.html#a04b59aa3c578bc75f88ac16a979c5fe6">lxw_error</a> workbook_set_custom_property_string </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structlxw__workbook.html">lxw_workbook</a> *&#160;</td>
          <td class="paramname"><em>workbook</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>value</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">workbook</td><td>Pointer to a <a class="el" href="structlxw__workbook.html" title="Struct to represent an Excel workbook.">lxw_workbook</a> instance. </td></tr>
    <tr><td class="paramname">name</td><td>The name of the custom property. </td></tr>
    <tr><td class="paramname">value</td><td>The value of the custom property.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A <a class="el" href="common_8h.html#a96384aee66a82d783d695374078e1ea9" title="Error codes from libxlsxwriter functions.">lxw_error</a>.</dd></dl>
<p>The <code>workbook_set_custom_property_string()</code> function can be used to set one or more custom document text properties not covered by the standard properties in the <code><a class="el" href="workbook_8h.html#aa814fd7f8d2c3ce86a7aa5d5ed127000" title="Set the document properties such as Title, Author etc.">workbook_set_properties()</a></code> function above.</p>
<p>For example:</p>
<div class="fragment"><div class="line"><a class="code" href="workbook_8h.html#a337caad1c1cb16fed505a180d77f20d3">workbook_set_custom_property_string</a>(workbook, <span class="stringliteral">&quot;Checked by&quot;</span>, <span class="stringliteral">&quot;Eve&quot;</span>);</div>
</div><!-- fragment --><div class="image">
<img src="custom_properties.png" alt=""/>
</div>
<p>There are 4 <code>workbook_set_custom_property_string_*()</code> functions for each of the custom property types supported by Excel:</p>
<ul>
<li>text/string: <code><a class="el" href="workbook_8h.html#a337caad1c1cb16fed505a180d77f20d3" title="Set a custom document text property.">workbook_set_custom_property_string()</a></code></li>
<li>number: <code><a class="el" href="workbook_8h.html#af2d8534bf9d58e48491a761228d31e14" title="Set a custom document number property.">workbook_set_custom_property_number()</a></code></li>
<li>datetime: <code><a class="el" href="workbook_8h.html#a843f0d1132a7eb3f8e3e9518ff27e5c9" title="Set a custom document date or time property.">workbook_set_custom_property_datetime()</a></code></li>
<li>boolean: <code><a class="el" href="workbook_8h.html#a929d2f7063651d872ccac14180e042a4" title="Set a custom document boolean property.">workbook_set_custom_property_boolean()</a></code></li>
</ul>
<p><b>Note</b>: the name and value parameters are limited to 255 characters by Excel. </p>
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="doc_custom_properties_8c-example.html#a5">doc_custom_properties.c</a>.</dd>
</dl>

</div>
</div>
<a id="af2d8534bf9d58e48491a761228d31e14"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af2d8534bf9d58e48491a761228d31e14">&#9670;&nbsp;</a></span>workbook_set_custom_property_number()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="common_8h.html#a04b59aa3c578bc75f88ac16a979c5fe6">lxw_error</a> workbook_set_custom_property_number </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structlxw__workbook.html">lxw_workbook</a> *&#160;</td>
          <td class="paramname"><em>workbook</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double&#160;</td>
          <td class="paramname"><em>value</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">workbook</td><td>Pointer to a <a class="el" href="structlxw__workbook.html" title="Struct to represent an Excel workbook.">lxw_workbook</a> instance. </td></tr>
    <tr><td class="paramname">name</td><td>The name of the custom property. </td></tr>
    <tr><td class="paramname">value</td><td>The value of the custom property.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A <a class="el" href="common_8h.html#a96384aee66a82d783d695374078e1ea9" title="Error codes from libxlsxwriter functions.">lxw_error</a>.</dd></dl>
<p>Set a custom document number property. See <code><a class="el" href="workbook_8h.html#a337caad1c1cb16fed505a180d77f20d3" title="Set a custom document text property.">workbook_set_custom_property_string()</a></code> above for details.</p>
<div class="fragment"><div class="line"><a class="code" href="workbook_8h.html#af2d8534bf9d58e48491a761228d31e14">workbook_set_custom_property_number</a>(workbook, <span class="stringliteral">&quot;Document number&quot;</span>, 12345);</div>
</div><!-- fragment --> <dl class="section examples"><dt>Examples</dt><dd><a class="el" href="doc_custom_properties_8c-example.html#a7">doc_custom_properties.c</a>.</dd>
</dl>

</div>
</div>
<a id="a929d2f7063651d872ccac14180e042a4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a929d2f7063651d872ccac14180e042a4">&#9670;&nbsp;</a></span>workbook_set_custom_property_boolean()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="common_8h.html#a04b59aa3c578bc75f88ac16a979c5fe6">lxw_error</a> workbook_set_custom_property_boolean </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structlxw__workbook.html">lxw_workbook</a> *&#160;</td>
          <td class="paramname"><em>workbook</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>value</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">workbook</td><td>Pointer to a <a class="el" href="structlxw__workbook.html" title="Struct to represent an Excel workbook.">lxw_workbook</a> instance. </td></tr>
    <tr><td class="paramname">name</td><td>The name of the custom property. </td></tr>
    <tr><td class="paramname">value</td><td>The value of the custom property.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A <a class="el" href="common_8h.html#a96384aee66a82d783d695374078e1ea9" title="Error codes from libxlsxwriter functions.">lxw_error</a>.</dd></dl>
<p>Set a custom document boolean property. See <code><a class="el" href="workbook_8h.html#a337caad1c1cb16fed505a180d77f20d3" title="Set a custom document text property.">workbook_set_custom_property_string()</a></code> above for details.</p>
<div class="fragment"><div class="line"><a class="code" href="workbook_8h.html#a929d2f7063651d872ccac14180e042a4">workbook_set_custom_property_boolean</a>(workbook, <span class="stringliteral">&quot;Has Review&quot;</span>, 1);</div>
</div><!-- fragment --> <dl class="section examples"><dt>Examples</dt><dd><a class="el" href="doc_custom_properties_8c-example.html#a8">doc_custom_properties.c</a>.</dd>
</dl>

</div>
</div>
<a id="a843f0d1132a7eb3f8e3e9518ff27e5c9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a843f0d1132a7eb3f8e3e9518ff27e5c9">&#9670;&nbsp;</a></span>workbook_set_custom_property_datetime()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="common_8h.html#a04b59aa3c578bc75f88ac16a979c5fe6">lxw_error</a> workbook_set_custom_property_datetime </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structlxw__workbook.html">lxw_workbook</a> *&#160;</td>
          <td class="paramname"><em>workbook</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structlxw__datetime.html">lxw_datetime</a> *&#160;</td>
          <td class="paramname"><em>datetime</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">workbook</td><td>Pointer to a <a class="el" href="structlxw__workbook.html" title="Struct to represent an Excel workbook.">lxw_workbook</a> instance. </td></tr>
    <tr><td class="paramname">name</td><td>The name of the custom property. </td></tr>
    <tr><td class="paramname">datetime</td><td>The value of the custom property.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A <a class="el" href="common_8h.html#a96384aee66a82d783d695374078e1ea9" title="Error codes from libxlsxwriter functions.">lxw_error</a>.</dd></dl>
<p>Set a custom date or time number property. See <code><a class="el" href="workbook_8h.html#a337caad1c1cb16fed505a180d77f20d3" title="Set a custom document text property.">workbook_set_custom_property_string()</a></code> above for details.</p>
<div class="fragment"><div class="line"><a class="code" href="structlxw__datetime.html">lxw_datetime</a> datetime  = {2016, 12, 1,  11, 55, 0.0};</div>
<div class="line"> </div>
<div class="line"><a class="code" href="workbook_8h.html#a843f0d1132a7eb3f8e3e9518ff27e5c9">workbook_set_custom_property_datetime</a>(workbook, <span class="stringliteral">&quot;Date completed&quot;</span>, &amp;datetime);</div>
</div><!-- fragment --> <dl class="section examples"><dt>Examples</dt><dd><a class="el" href="doc_custom_properties_8c-example.html#a6">doc_custom_properties.c</a>.</dd>
</dl>

</div>
</div>
<a id="a442b4056e8d4debf56c07888f2a776f6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a442b4056e8d4debf56c07888f2a776f6">&#9670;&nbsp;</a></span>workbook_define_name()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="common_8h.html#a04b59aa3c578bc75f88ac16a979c5fe6">lxw_error</a> workbook_define_name </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structlxw__workbook.html">lxw_workbook</a> *&#160;</td>
          <td class="paramname"><em>workbook</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>formula</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">workbook</td><td>Pointer to a <a class="el" href="structlxw__workbook.html" title="Struct to represent an Excel workbook.">lxw_workbook</a> instance. </td></tr>
    <tr><td class="paramname">name</td><td>The defined name. </td></tr>
    <tr><td class="paramname">formula</td><td>The cell or range that the defined name refers to.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A <a class="el" href="common_8h.html#a96384aee66a82d783d695374078e1ea9" title="Error codes from libxlsxwriter functions.">lxw_error</a>.</dd></dl>
<p>This function is used to defined a name that can be used to represent a value, a single cell or a range of cells in a workbook: These defined names can then be used in formulas:</p>
<div class="fragment"><div class="line"><a class="code" href="workbook_8h.html#a442b4056e8d4debf56c07888f2a776f6">workbook_define_name</a>(workbook, <span class="stringliteral">&quot;Exchange_rate&quot;</span>, <span class="stringliteral">&quot;=0.96&quot;</span>);</div>
<div class="line"><a class="code" href="worksheet_8h.html#ae57117f04c82bef29805ec3eabc219bb">worksheet_write_formula</a>(worksheet, 2, 1, <span class="stringliteral">&quot;=Exchange_rate&quot;</span>, NULL);</div>
</div><!-- fragment --><div class="image">
<img src="defined_name.png" alt=""/>
</div>
<p>As in Excel a name defined like this is "global" to the workbook and can be referred to from any worksheet:</p>
<div class="fragment"><div class="line"><span class="comment">// Global workbook name.</span></div>
<div class="line"><a class="code" href="workbook_8h.html#a442b4056e8d4debf56c07888f2a776f6">workbook_define_name</a>(workbook, <span class="stringliteral">&quot;Sales&quot;</span>, <span class="stringliteral">&quot;=Sheet1!$G$1:$H$10&quot;</span>);</div>
</div><!-- fragment --><p>It is also possible to define a local/worksheet name by prefixing it with the sheet name using the syntax &lsquo;'sheetname!definedname&rsquo;`:</p>
<div class="fragment"><div class="line"><span class="comment">// Local worksheet name.</span></div>
<div class="line"><a class="code" href="workbook_8h.html#a442b4056e8d4debf56c07888f2a776f6">workbook_define_name</a>(workbook, <span class="stringliteral">&quot;Sheet2!Sales&quot;</span>, <span class="stringliteral">&quot;=Sheet2!$G$1:$G$10&quot;</span>);</div>
</div><!-- fragment --><p>If the sheet name contains spaces or special characters you must follow the Excel convention and enclose it in single quotes:</p>
<div class="fragment"><div class="line"><a class="code" href="workbook_8h.html#a442b4056e8d4debf56c07888f2a776f6">workbook_define_name</a>(workbook, <span class="stringliteral">&quot;&#39;New Data&#39;!Sales&quot;</span>, <span class="stringliteral">&quot;=Sheet2!$G$1:$G$10&quot;</span>);</div>
</div><!-- fragment --><p>The rules for names in Excel are explained in the <a href="http://office.microsoft.com/en-001/excel-help/define-and-use-names-in-formulas-HA010147120.aspx">Microsoft Office documentation</a>. </p>
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="defined_name_8c-example.html#a4">defined_name.c</a>.</dd>
</dl>

</div>
</div>
<a id="abd18b07856137e94b34c9aca7e0831b5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abd18b07856137e94b34c9aca7e0831b5">&#9670;&nbsp;</a></span>workbook_get_default_url_format()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structlxw__format.html">lxw_format</a>* workbook_get_default_url_format </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structlxw__workbook.html">lxw_workbook</a> *&#160;</td>
          <td class="paramname"><em>workbook</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">workbook</td><td>Pointer to a <a class="el" href="structlxw__workbook.html" title="Struct to represent an Excel workbook.">lxw_workbook</a> instance. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A <a class="el" href="structlxw__format.html" title="Struct to represent the formatting properties of an Excel format.">lxw_format</a> instance that has hyperlink properties set.</dd></dl>
<p>This function returns a <a class="el" href="structlxw__format.html" title="Struct to represent the formatting properties of an Excel format.">lxw_format</a> instance that is used for the default blue underline hyperlink in the <code><a class="el" href="worksheet_8h.html#a9b2ac96ee23574a432f5703eedcaf9a1">worksheet_write_url()</a></code> function when a format isn't specified:</p>
<div class="fragment"><div class="line"><a class="code" href="structlxw__format.html">lxw_format</a> *url_format = <a class="code" href="workbook_8h.html#abd18b07856137e94b34c9aca7e0831b5">workbook_get_default_url_format</a>(workbook);</div>
</div><!-- fragment --><p>The format is the hyperlink style defined by Excel for the default theme. This format is only ever required when overwriting a string URL with data of a different type. See the example below. </p>
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="hyperlinks_8c-example.html#a5">hyperlinks.c</a>.</dd>
</dl>

</div>
</div>
<a id="a857f1d02d04a7d5a039642abde91c280"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a857f1d02d04a7d5a039642abde91c280">&#9670;&nbsp;</a></span>workbook_get_worksheet_by_name()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structlxw__worksheet.html">lxw_worksheet</a>* workbook_get_worksheet_by_name </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structlxw__workbook.html">lxw_workbook</a> *&#160;</td>
          <td class="paramname"><em>workbook</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">workbook</td><td>Pointer to a <a class="el" href="structlxw__workbook.html" title="Struct to represent an Excel workbook.">lxw_workbook</a> instance. </td></tr>
    <tr><td class="paramname">name</td><td>Worksheet name.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A <a class="el" href="structlxw__worksheet.html" title="Struct to represent an Excel worksheet.">lxw_worksheet</a> object.</dd></dl>
<p>This function returns a <a class="el" href="structlxw__worksheet.html" title="Struct to represent an Excel worksheet.">lxw_worksheet</a> object reference based on its name:</p>
<div class="fragment"><div class="line">worksheet = <a class="code" href="workbook_8h.html#a857f1d02d04a7d5a039642abde91c280">workbook_get_worksheet_by_name</a>(workbook, <span class="stringliteral">&quot;Sheet1&quot;</span>);</div>
</div><!-- fragment --> 
</div>
</div>
<a id="aaf401cf363d4e497ca72dba14d53af42"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aaf401cf363d4e497ca72dba14d53af42">&#9670;&nbsp;</a></span>workbook_get_chartsheet_by_name()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structlxw__chartsheet.html">lxw_chartsheet</a>* workbook_get_chartsheet_by_name </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structlxw__workbook.html">lxw_workbook</a> *&#160;</td>
          <td class="paramname"><em>workbook</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">workbook</td><td>Pointer to a <a class="el" href="structlxw__workbook.html" title="Struct to represent an Excel workbook.">lxw_workbook</a> instance. </td></tr>
    <tr><td class="paramname">name</td><td>chartsheet name.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A <a class="el" href="structlxw__chartsheet.html" title="Struct to represent an Excel chartsheet.">lxw_chartsheet</a> object.</dd></dl>
<p>This function returns a <a class="el" href="structlxw__chartsheet.html" title="Struct to represent an Excel chartsheet.">lxw_chartsheet</a> object reference based on its name:</p>
<div class="fragment"><div class="line">chartsheet = <a class="code" href="workbook_8h.html#aaf401cf363d4e497ca72dba14d53af42">workbook_get_chartsheet_by_name</a>(workbook, <span class="stringliteral">&quot;Chart1&quot;</span>);</div>
</div><!-- fragment --> 
</div>
</div>
<a id="a9ecbd616a8306c88210794140c434031"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9ecbd616a8306c88210794140c434031">&#9670;&nbsp;</a></span>workbook_validate_sheet_name()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="common_8h.html#a04b59aa3c578bc75f88ac16a979c5fe6">lxw_error</a> workbook_validate_sheet_name </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structlxw__workbook.html">lxw_workbook</a> *&#160;</td>
          <td class="paramname"><em>workbook</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>sheetname</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">workbook</td><td>Pointer to a <a class="el" href="structlxw__workbook.html" title="Struct to represent an Excel workbook.">lxw_workbook</a> instance. </td></tr>
    <tr><td class="paramname">sheetname</td><td>Sheet name to validate.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A <a class="el" href="common_8h.html#a96384aee66a82d783d695374078e1ea9" title="Error codes from libxlsxwriter functions.">lxw_error</a>.</dd></dl>
<p>This function is used to validate a worksheet or chartsheet name according to the rules used by Excel:</p>
<ul>
<li>The name is less than or equal to 31 UTF-8 characters.</li>
<li>The name doesn't contain any of the characters: <code>[ ] : * ? / \</code></li>
<li>The name doesn't start or end with an apostrophe.</li>
<li>The name isn't already in use. (Case insensitive, see the note below).</li>
</ul>
<div class="fragment"><div class="line"><a class="code" href="common_8h.html#a04b59aa3c578bc75f88ac16a979c5fe6">lxw_error</a> err = <a class="code" href="workbook_8h.html#a9ecbd616a8306c88210794140c434031">workbook_validate_sheet_name</a>(workbook, <span class="stringliteral">&quot;Foglio&quot;</span>);</div>
</div><!-- fragment --><p>This function is called by <code><a class="el" href="workbook_8h.html#a81d456b4f65a464e78e4a0030ecc3c2e" title="Add a new worksheet to a workbook.">workbook_add_worksheet()</a></code> and <code><a class="el" href="workbook_8h.html#a9cb69c057990a4139f0a19b53b04b805" title="Add a new chartsheet to a workbook.">workbook_add_chartsheet()</a></code> but it can be explicitly called by the user beforehand to ensure that the sheet name is valid.</p>
<dl class="section note"><dt>Note</dt><dd>You should also avoid using the worksheet name "History" (case insensitive) which is reserved in English language versions of Excel. Non-English versions may have restrictions on the equivalent word.</dd>
<dd>
This function does an ASCII lowercase string comparison to determine if the sheet name is already in use. It doesn't take UTF-8 characters into account. Thus it would flag "Café" and "café" as a duplicate (just like Excel) but it wouldn't catch "CAFÉ". If you need a full UTF-8 case insensitive check you should use a third party library to implement it. </dd></dl>

</div>
</div>
<a id="a8de478eed94be65de0622c64a0179ff9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8de478eed94be65de0622c64a0179ff9">&#9670;&nbsp;</a></span>workbook_add_vba_project()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="common_8h.html#a04b59aa3c578bc75f88ac16a979c5fe6">lxw_error</a> workbook_add_vba_project </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structlxw__workbook.html">lxw_workbook</a> *&#160;</td>
          <td class="paramname"><em>workbook</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>filename</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">workbook</td><td>Pointer to a <a class="el" href="structlxw__workbook.html" title="Struct to represent an Excel workbook.">lxw_workbook</a> instance. </td></tr>
    <tr><td class="paramname">filename</td><td>The path/filename of the vbaProject.bin file.</td></tr>
  </table>
  </dd>
</dl>
<p>The <code>workbook_add_vba_project()</code> function can be used to add macros or functions to a workbook using a binary VBA project file that has been extracted from an existing Excel xlsm file:</p>
<div class="fragment"><div class="line"><a class="code" href="workbook_8h.html#a8de478eed94be65de0622c64a0179ff9">workbook_add_vba_project</a>(workbook, <span class="stringliteral">&quot;vbaProject.bin&quot;</span>);</div>
</div><!-- fragment --><p>Only one <code>vbaProject.bin file</code> can be added per workbook. The name doesn't have to be <code>vbaProject.bin</code>. Any suitable path/name for an existing VBA bin file will do.</p>
<p>Once you add a VBA project had been add to an libxlsxwriter workbook you should ensure that the file extension is <code>.xlsm</code> to prevent Excel from giving a warning when it opens the file:</p>
<div class="fragment"><div class="line"><a class="code" href="structlxw__workbook.html">lxw_workbook</a> *workbook = new_workbook(<span class="stringliteral">&quot;macro.xlsm&quot;</span>);</div>
</div><!-- fragment --><p>See also <a class="el" href="working_with_macros.html">Working with VBA Macros</a></p>
<dl class="section return"><dt>Returns</dt><dd>A <a class="el" href="common_8h.html#a96384aee66a82d783d695374078e1ea9" title="Error codes from libxlsxwriter functions.">lxw_error</a>. </dd></dl>
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="macro_8c-example.html#a4">macro.c</a>.</dd>
</dl>

</div>
</div>
<a id="a24dd6624ffdc3e17aa5bcfb4608755b8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a24dd6624ffdc3e17aa5bcfb4608755b8">&#9670;&nbsp;</a></span>workbook_set_vba_name()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="common_8h.html#a04b59aa3c578bc75f88ac16a979c5fe6">lxw_error</a> workbook_set_vba_name </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structlxw__workbook.html">lxw_workbook</a> *&#160;</td>
          <td class="paramname"><em>workbook</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">workbook</td><td>Pointer to a <a class="el" href="structlxw__workbook.html" title="Struct to represent an Excel workbook.">lxw_workbook</a> instance. </td></tr>
    <tr><td class="paramname">name</td><td>Name of the workbook used by VBA.</td></tr>
  </table>
  </dd>
</dl>
<p>The <code><a class="el" href="workbook_8h.html#a24dd6624ffdc3e17aa5bcfb4608755b8" title="Set the VBA name for the workbook.">workbook_set_vba_name()</a></code> function can be used to set the VBA name for the workbook. This is sometimes required when a vbaProject macro included via <code><a class="el" href="workbook_8h.html#a8de478eed94be65de0622c64a0179ff9" title="Add a vbaProject binary to the Excel workbook.">workbook_add_vba_project()</a></code> refers to the workbook by a name other than <code>ThisWorkbook</code>.</p>
<div class="fragment"><div class="line"><a class="code" href="workbook_8h.html#a24dd6624ffdc3e17aa5bcfb4608755b8">workbook_set_vba_name</a>(workbook, <span class="stringliteral">&quot;MyWorkbook&quot;</span>);</div>
</div><!-- fragment --><p>If an Excel VBA name for the workbook isn't specified then libxlsxwriter will use <code>ThisWorkbook</code>.</p>
<p>See also <a class="el" href="working_with_macros.html">Working with VBA Macros</a></p>
<dl class="section return"><dt>Returns</dt><dd>A <a class="el" href="common_8h.html#a96384aee66a82d783d695374078e1ea9" title="Error codes from libxlsxwriter functions.">lxw_error</a>. </dd></dl>

</div>
</div>
<h2 class="groupheader">Typedef Documentation</h2>
<a id="a76827346b7ff0b189f505a42ccc81188"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a76827346b7ff0b189f505a42ccc81188">&#9670;&nbsp;</a></span>lxw_doc_properties</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef struct <a class="el" href="structlxw__doc__properties.html">lxw_doc_properties</a> <a class="el" href="structlxw__doc__properties.html">lxw_doc_properties</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Workbook document properties. Set any unused fields to NULL or 0. </p>

</div>
</div>
<a id="ad601701f634197901be8c248e8539b96"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad601701f634197901be8c248e8539b96">&#9670;&nbsp;</a></span>lxw_workbook_options</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef struct <a class="el" href="structlxw__workbook__options.html">lxw_workbook_options</a> <a class="el" href="structlxw__workbook__options.html">lxw_workbook_options</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Optional parameters when creating a new Workbook object via <a class="el" href="workbook_8h.html#a8ca9bd8c30c618b81ca6180f78b03323" title="Create a new workbook object, and set the workbook options.">workbook_new_opt()</a>.</p>
<p>The following properties are supported:</p>
<ul>
<li><code>constant_memory</code>: This option reduces the amount of data stored in memory so that large files can be written efficiently. This option is off by default. See the note below for limitations when this mode is on.</li>
<li><code>tmpdir</code>: libxlsxwriter stores workbook data in temporary files prior to assembling the final XLSX file. The temporary files are created in the system's temp directory. If the default temporary directory isn't accessible to your application, or doesn't contain enough space, you can specify an alternative location using the <code>tmpdir</code> option.</li>
<li><code>use_zip64</code>: Make the zip library use ZIP64 extensions when writing very large xlsx files to allow the zip container, or individual XML files within it, to be greater than 4 GB. See <a href="https://en.wikipedia.org/wiki/Zip_(file_format)#ZIP64">ZIP64 on Wikipedia</a> for more information. This option is off by default.</li>
</ul>
<dl class="section note"><dt>Note</dt><dd>In <code>constant_memory</code> mode a row of data is written and then discarded when a cell in a new row is added via one of the <code>worksheet_write_*()</code> functions. Therefore, once this option is active, data should be written in sequential row order. For this reason the <code><a class="el" href="worksheet_8h.html#ad5a2a09ec65c0f286b756235c7327225" title="Merge a range of cells.">worksheet_merge_range()</a></code> doesn't work in this mode. See also <a class="el" href="working_with_memory.html#ww_mem_constant">Constant Memory Mode</a>. </dd></dl>

</div>
</div>
<a id="ac867e22dab78808b972b6e9e6ccf5c13"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac867e22dab78808b972b6e9e6ccf5c13">&#9670;&nbsp;</a></span>lxw_workbook</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef struct <a class="el" href="structlxw__workbook.html">lxw_workbook</a> <a class="el" href="structlxw__workbook.html">lxw_workbook</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>The members of the <a class="el" href="structlxw__workbook.html" title="Struct to represent an Excel workbook.">lxw_workbook</a> struct aren't modified directly. Instead the workbook properties are set by calling the functions shown in <a class="el" href="workbook_8h.html" title="Functions related to creating an Excel xlsx workbook.">workbook.h</a>. </p>

</div>
</div>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a82e722c1ca15a5fd8295dd0103b18caf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a82e722c1ca15a5fd8295dd0103b18caf">&#9670;&nbsp;</a></span>LXW_FOREACH_WORKSHEET</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define LXW_FOREACH_WORKSHEET</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">worksheet, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">workbook&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;    STAILQ_FOREACH((worksheet), (workbook)-&gt;worksheets, list_pointers)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This macro allows you to loop over all the worksheets that have been added to a workbook. You must provide a <a class="el" href="structlxw__worksheet.html" title="Struct to represent an Excel worksheet.">lxw_worksheet</a> pointer and a pointer to the <a class="el" href="structlxw__workbook.html" title="Struct to represent an Excel workbook.">lxw_workbook</a>:</p>
<div class="fragment"><div class="line"><a class="code" href="structlxw__workbook.html">lxw_workbook</a>  *workbook = <a class="code" href="workbook_8h.html#a1cf96608a23ee4eb0e8467c15240d00b">workbook_new</a>(<span class="stringliteral">&quot;test.xlsx&quot;</span>);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="structlxw__worksheet.html">lxw_worksheet</a> *worksheet; <span class="comment">// Generic worksheet pointer.</span></div>
<div class="line"> </div>
<div class="line"><span class="comment">// Worksheet objects used in the program.</span></div>
<div class="line"><a class="code" href="structlxw__worksheet.html">lxw_worksheet</a> *worksheet1 = <a class="code" href="workbook_8h.html#a81d456b4f65a464e78e4a0030ecc3c2e">workbook_add_worksheet</a>(workbook, NULL);</div>
<div class="line"><a class="code" href="structlxw__worksheet.html">lxw_worksheet</a> *worksheet2 = <a class="code" href="workbook_8h.html#a81d456b4f65a464e78e4a0030ecc3c2e">workbook_add_worksheet</a>(workbook, NULL);</div>
<div class="line"><a class="code" href="structlxw__worksheet.html">lxw_worksheet</a> *worksheet3 = <a class="code" href="workbook_8h.html#a81d456b4f65a464e78e4a0030ecc3c2e">workbook_add_worksheet</a>(workbook, NULL);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Iterate over the 3 worksheets and perform the same operation on each.</span></div>
<div class="line"><a class="code" href="workbook_8h.html#a82e722c1ca15a5fd8295dd0103b18caf">LXW_FOREACH_WORKSHEET</a>(worksheet, workbook) {</div>
<div class="line">    <a class="code" href="worksheet_8h.html#ac208046e7a6d12cc87982422efa41b31">worksheet_write_string</a>(worksheet, 0, 0, <span class="stringliteral">&quot;Hello&quot;</span>, NULL);</div>
<div class="line">}</div>
</div><!-- fragment --> <dl class="section examples"><dt>Examples</dt><dd><a class="el" href="defined_name_8c-example.html#a5">defined_name.c</a>.</dd>
</dl>

</div>
</div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structlxw__doc__properties.html">lxw_doc_properties</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structlxw__workbook__options.html">lxw_workbook_options</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Workbook options.  <a href="structlxw__workbook__options.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structlxw__workbook.html">lxw_workbook</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Struct to represent an Excel workbook.  <a href="structlxw__workbook.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:a76827346b7ff0b189f505a42ccc81188"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="structlxw__doc__properties.html">lxw_doc_properties</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workbook_8h.html#a76827346b7ff0b189f505a42ccc81188">lxw_doc_properties</a></td></tr>
<tr class="separator:a76827346b7ff0b189f505a42ccc81188"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad601701f634197901be8c248e8539b96"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="structlxw__workbook__options.html">lxw_workbook_options</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workbook_8h.html#ad601701f634197901be8c248e8539b96">lxw_workbook_options</a></td></tr>
<tr class="memdesc:ad601701f634197901be8c248e8539b96"><td class="mdescLeft">&#160;</td><td class="mdescRight">Workbook options.  <a href="workbook_8h.html#ad601701f634197901be8c248e8539b96">More...</a><br /></td></tr>
<tr class="separator:ad601701f634197901be8c248e8539b96"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac867e22dab78808b972b6e9e6ccf5c13"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="structlxw__workbook.html">lxw_workbook</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workbook_8h.html#ac867e22dab78808b972b6e9e6ccf5c13">lxw_workbook</a></td></tr>
<tr class="memdesc:ac867e22dab78808b972b6e9e6ccf5c13"><td class="mdescLeft">&#160;</td><td class="mdescRight">Struct to represent an Excel workbook.  <a href="workbook_8h.html#ac867e22dab78808b972b6e9e6ccf5c13">More...</a><br /></td></tr>
<tr class="separator:ac867e22dab78808b972b6e9e6ccf5c13"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a82e722c1ca15a5fd8295dd0103b18caf"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workbook_8h.html#a82e722c1ca15a5fd8295dd0103b18caf">LXW_FOREACH_WORKSHEET</a>(worksheet,  workbook)&#160;&#160;&#160;    STAILQ_FOREACH((worksheet), (workbook)-&gt;worksheets, list_pointers)</td></tr>
<tr class="memdesc:a82e722c1ca15a5fd8295dd0103b18caf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Macro to loop over all the worksheets in a workbook.  <a href="workbook_8h.html#a82e722c1ca15a5fd8295dd0103b18caf">More...</a><br /></td></tr>
<tr class="separator:a82e722c1ca15a5fd8295dd0103b18caf"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
</div><!-- contents -->
<div class="ttc" id="aworkbook_8h_html_aaf401cf363d4e497ca72dba14d53af42"><div class="ttname"><a href="workbook_8h.html#aaf401cf363d4e497ca72dba14d53af42">workbook_get_chartsheet_by_name</a></div><div class="ttdeci">lxw_chartsheet * workbook_get_chartsheet_by_name(lxw_workbook *workbook, const char *name)</div><div class="ttdoc">Get a chartsheet object from its name.</div></div>
<div class="ttc" id="aworkbook_8h_html_a9cb69c057990a4139f0a19b53b04b805"><div class="ttname"><a href="workbook_8h.html#a9cb69c057990a4139f0a19b53b04b805">workbook_add_chartsheet</a></div><div class="ttdeci">lxw_chartsheet * workbook_add_chartsheet(lxw_workbook *workbook, const char *sheetname)</div><div class="ttdoc">Add a new chartsheet to a workbook.</div></div>
<div class="ttc" id="aworkbook_8h_html_ad9e7aeebc0fd43562db5bcd527b2ee5e"><div class="ttname"><a href="workbook_8h.html#ad9e7aeebc0fd43562db5bcd527b2ee5e">workbook_close</a></div><div class="ttdeci">lxw_error workbook_close(lxw_workbook *workbook)</div><div class="ttdoc">Close the Workbook object and write the XLSX file.</div></div>
<div class="ttc" id="astructlxw__workbook__options_html_aa03636857813ca881bdd09e07bcbe738"><div class="ttname"><a href="structlxw__workbook__options.html#aa03636857813ca881bdd09e07bcbe738">lxw_workbook_options::constant_memory</a></div><div class="ttdeci">uint8_t constant_memory</div><div class="ttdef"><b>Definition:</b> workbook.h:256</div></div>
<div class="ttc" id="astructlxw__workbook__options_html"><div class="ttname"><a href="structlxw__workbook__options.html">lxw_workbook_options</a></div><div class="ttdoc">Workbook options.</div><div class="ttdef"><b>Definition:</b> workbook.h:254</div></div>
<div class="ttc" id="aworksheet_8h_html_ae57117f04c82bef29805ec3eabc219bb"><div class="ttname"><a href="worksheet_8h.html#ae57117f04c82bef29805ec3eabc219bb">worksheet_write_formula</a></div><div class="ttdeci">lxw_error worksheet_write_formula(lxw_worksheet *worksheet, lxw_row_t row, lxw_col_t col, const char *formula, lxw_format *format)</div><div class="ttdoc">Write a formula to a worksheet cell.</div></div>
<div class="ttc" id="acommon_8h_html_a57bffaf0ff3cb4e9f4f7f2b0b6dad349a847f574cc183a1d8a4e3800fe28091f4"><div class="ttname"><a href="common_8h.html#a57bffaf0ff3cb4e9f4f7f2b0b6dad349a847f574cc183a1d8a4e3800fe28091f4">LXW_FALSE</a></div><div class="ttdeci">@ LXW_FALSE</div><div class="ttdef"><b>Definition:</b> common.h:51</div></div>
<div class="ttc" id="achart_8h_html_ad60de0eb056e93435407e91482115f55"><div class="ttname"><a href="chart_8h.html#ad60de0eb056e93435407e91482115f55">chart_add_series</a></div><div class="ttdeci">lxw_chart_series * chart_add_series(lxw_chart *chart, const char *categories, const char *values)</div><div class="ttdoc">Add a data series to a chart.</div></div>
<div class="ttc" id="aworkbook_8h_html_a1cf96608a23ee4eb0e8467c15240d00b"><div class="ttname"><a href="workbook_8h.html#a1cf96608a23ee4eb0e8467c15240d00b">workbook_new</a></div><div class="ttdeci">lxw_workbook * workbook_new(const char *filename)</div><div class="ttdoc">Create a new workbook object.</div></div>
<div class="ttc" id="aworkbook_8h_html_a8ca9bd8c30c618b81ca6180f78b03323"><div class="ttname"><a href="workbook_8h.html#a8ca9bd8c30c618b81ca6180f78b03323">workbook_new_opt</a></div><div class="ttdeci">lxw_workbook * workbook_new_opt(const char *filename, lxw_workbook_options *options)</div><div class="ttdoc">Create a new workbook object, and set the workbook options.</div></div>
<div class="ttc" id="aworkbook_8h_html_a82e722c1ca15a5fd8295dd0103b18caf"><div class="ttname"><a href="workbook_8h.html#a82e722c1ca15a5fd8295dd0103b18caf">LXW_FOREACH_WORKSHEET</a></div><div class="ttdeci">#define LXW_FOREACH_WORKSHEET(worksheet, workbook)</div><div class="ttdoc">Macro to loop over all the worksheets in a workbook.</div><div class="ttdef"><b>Definition:</b> workbook.h:163</div></div>
<div class="ttc" id="aworkbook_8h_html_a857f1d02d04a7d5a039642abde91c280"><div class="ttname"><a href="workbook_8h.html#a857f1d02d04a7d5a039642abde91c280">workbook_get_worksheet_by_name</a></div><div class="ttdeci">lxw_worksheet * workbook_get_worksheet_by_name(lxw_workbook *workbook, const char *name)</div><div class="ttdoc">Get a worksheet object from its name.</div></div>
<div class="ttc" id="aformat_8h_html_a85e1b0baf44b445b65894e48722aec14"><div class="ttname"><a href="format_8h.html#a85e1b0baf44b445b65894e48722aec14">format_set_bold</a></div><div class="ttdeci">void format_set_bold(lxw_format *format)</div><div class="ttdoc">Turn on bold for the format font.</div></div>
<div class="ttc" id="aworkbook_8h_html_a843f0d1132a7eb3f8e3e9518ff27e5c9"><div class="ttname"><a href="workbook_8h.html#a843f0d1132a7eb3f8e3e9518ff27e5c9">workbook_set_custom_property_datetime</a></div><div class="ttdeci">lxw_error workbook_set_custom_property_datetime(lxw_workbook *workbook, const char *name, lxw_datetime *datetime)</div><div class="ttdoc">Set a custom document date or time property.</div></div>
<div class="ttc" id="astructlxw__worksheet_html"><div class="ttname"><a href="structlxw__worksheet.html">lxw_worksheet</a></div><div class="ttdoc">Struct to represent an Excel worksheet.</div><div class="ttdef"><b>Definition:</b> worksheet.h:1603</div></div>
<div class="ttc" id="aworkbook_8h_html_af2d8534bf9d58e48491a761228d31e14"><div class="ttname"><a href="workbook_8h.html#af2d8534bf9d58e48491a761228d31e14">workbook_set_custom_property_number</a></div><div class="ttdeci">lxw_error workbook_set_custom_property_number(lxw_workbook *workbook, const char *name, double value)</div><div class="ttdoc">Set a custom document number property.</div></div>
<div class="ttc" id="aworkbook_8h_html_a442b4056e8d4debf56c07888f2a776f6"><div class="ttname"><a href="workbook_8h.html#a442b4056e8d4debf56c07888f2a776f6">workbook_define_name</a></div><div class="ttdeci">lxw_error workbook_define_name(lxw_workbook *workbook, const char *name, const char *formula)</div><div class="ttdoc">Create a defined name in the workbook to use as a variable.</div></div>
<div class="ttc" id="aworkbook_8h_html_abd18b07856137e94b34c9aca7e0831b5"><div class="ttname"><a href="workbook_8h.html#abd18b07856137e94b34c9aca7e0831b5">workbook_get_default_url_format</a></div><div class="ttdeci">lxw_format * workbook_get_default_url_format(lxw_workbook *workbook)</div><div class="ttdoc">Get the default URL format used with worksheet_write_url().</div></div>
<div class="ttc" id="aworkbook_8h_html_aa814fd7f8d2c3ce86a7aa5d5ed127000"><div class="ttname"><a href="workbook_8h.html#aa814fd7f8d2c3ce86a7aa5d5ed127000">workbook_set_properties</a></div><div class="ttdeci">lxw_error workbook_set_properties(lxw_workbook *workbook, lxw_doc_properties *properties)</div><div class="ttdoc">Set the document properties such as Title, Author etc.</div></div>
<div class="ttc" id="acommon_8h_html_a04b59aa3c578bc75f88ac16a979c5fe6"><div class="ttname"><a href="common_8h.html#a04b59aa3c578bc75f88ac16a979c5fe6">lxw_error</a></div><div class="ttdeci">lxw_error</div><div class="ttdoc">Error codes from libxlsxwriter functions.</div><div class="ttdef"><b>Definition:</b> common.h:62</div></div>
<div class="ttc" id="aworkbook_8h_html_a8de478eed94be65de0622c64a0179ff9"><div class="ttname"><a href="workbook_8h.html#a8de478eed94be65de0622c64a0179ff9">workbook_add_vba_project</a></div><div class="ttdeci">lxw_error workbook_add_vba_project(lxw_workbook *workbook, const char *filename)</div><div class="ttdoc">Add a vbaProject binary to the Excel workbook.</div></div>
<div class="ttc" id="astructlxw__format_html"><div class="ttname"><a href="structlxw__format.html">lxw_format</a></div><div class="ttdoc">Struct to represent the formatting properties of an Excel format.</div><div class="ttdef"><b>Definition:</b> format.h:358</div></div>
<div class="ttc" id="acommon_8h_html_a57bffaf0ff3cb4e9f4f7f2b0b6dad349a7850bcc34c18efe2e45372f4069be0bf"><div class="ttname"><a href="common_8h.html#a57bffaf0ff3cb4e9f4f7f2b0b6dad349a7850bcc34c18efe2e45372f4069be0bf">LXW_TRUE</a></div><div class="ttdeci">@ LXW_TRUE</div><div class="ttdef"><b>Definition:</b> common.h:53</div></div>
<div class="ttc" id="astructlxw__chart_html"><div class="ttname"><a href="structlxw__chart.html">lxw_chart</a></div><div class="ttdoc">Struct to represent an Excel chart.</div><div class="ttdef"><b>Definition:</b> chart.h:1086</div></div>
<div class="ttc" id="aworksheet_8h_html_ac2067faaacb8bfa6550b019e915900a2"><div class="ttname"><a href="worksheet_8h.html#ac2067faaacb8bfa6550b019e915900a2">worksheet_insert_chart</a></div><div class="ttdeci">lxw_error worksheet_insert_chart(lxw_worksheet *worksheet, lxw_row_t row, lxw_col_t col, lxw_chart *chart)</div><div class="ttdoc">Insert a chart object into a worksheet.</div></div>
<div class="ttc" id="aworkbook_8h_html_a929d2f7063651d872ccac14180e042a4"><div class="ttname"><a href="workbook_8h.html#a929d2f7063651d872ccac14180e042a4">workbook_set_custom_property_boolean</a></div><div class="ttdeci">lxw_error workbook_set_custom_property_boolean(lxw_workbook *workbook, const char *name, uint8_t value)</div><div class="ttdoc">Set a custom document boolean property.</div></div>
<div class="ttc" id="astructlxw__datetime_html"><div class="ttname"><a href="structlxw__datetime.html">lxw_datetime</a></div><div class="ttdoc">Struct to represent a date and time in Excel.</div><div class="ttdef"><b>Definition:</b> common.h:152</div></div>
<div class="ttc" id="aworkbook_8h_html_a9ecbd616a8306c88210794140c434031"><div class="ttname"><a href="workbook_8h.html#a9ecbd616a8306c88210794140c434031">workbook_validate_sheet_name</a></div><div class="ttdeci">lxw_error workbook_validate_sheet_name(lxw_workbook *workbook, const char *sheetname)</div><div class="ttdoc">Validate a worksheet or chartsheet name.</div></div>
<div class="ttc" id="astructlxw__doc__properties_html_a23d8fd5995ef26d1eab54c4dbd92393c"><div class="ttname"><a href="structlxw__doc__properties.html#a23d8fd5995ef26d1eab54c4dbd92393c">lxw_doc_properties::title</a></div><div class="ttdeci">char * title</div><div class="ttdef"><b>Definition:</b> workbook.h:185</div></div>
<div class="ttc" id="astructlxw__workbook_html"><div class="ttname"><a href="structlxw__workbook.html">lxw_workbook</a></div><div class="ttdoc">Struct to represent an Excel workbook.</div><div class="ttdef"><b>Definition:</b> workbook.h:273</div></div>
<div class="ttc" id="aworkbook_8h_html_a24dd6624ffdc3e17aa5bcfb4608755b8"><div class="ttname"><a href="workbook_8h.html#a24dd6624ffdc3e17aa5bcfb4608755b8">workbook_set_vba_name</a></div><div class="ttdeci">lxw_error workbook_set_vba_name(lxw_workbook *workbook, const char *name)</div><div class="ttdoc">Set the VBA name for the workbook.</div></div>
<div class="ttc" id="aworksheet_8h_html_ac208046e7a6d12cc87982422efa41b31"><div class="ttname"><a href="worksheet_8h.html#ac208046e7a6d12cc87982422efa41b31">worksheet_write_string</a></div><div class="ttdeci">lxw_error worksheet_write_string(lxw_worksheet *worksheet, lxw_row_t row, lxw_col_t col, const char *string, lxw_format *format)</div><div class="ttdoc">Write a string to a worksheet cell.</div></div>
<div class="ttc" id="aformat_8h_html_abeafc6e8222ba9fcfd4f2c2f4e9ea38baedd7412491d9f34fc5f947ada9d196ec"><div class="ttname"><a href="format_8h.html#abeafc6e8222ba9fcfd4f2c2f4e9ea38baedd7412491d9f34fc5f947ada9d196ec">LXW_COLOR_RED</a></div><div class="ttdeci">@ LXW_COLOR_RED</div><div class="ttdef"><b>Definition:</b> format.h:217</div></div>
<div class="ttc" id="aformat_8h_html_a61981b2080bfe6381ede5358ee05b05c"><div class="ttname"><a href="format_8h.html#a61981b2080bfe6381ede5358ee05b05c">format_set_font_color</a></div><div class="ttdeci">void format_set_font_color(lxw_format *format, lxw_color_t color)</div><div class="ttdoc">Set the color of the font used in the cell.</div></div>
<div class="ttc" id="autility_8h_html_ad510ac6df573d23203374e24dba373d2"><div class="ttname"><a href="utility_8h.html#ad510ac6df573d23203374e24dba373d2">CELL</a></div><div class="ttdeci">#define CELL(cell)</div><div class="ttdoc">Convert an Excel A1 cell string into a (row, col) pair.</div><div class="ttdef"><b>Definition:</b> utility.h:45</div></div>
<div class="ttc" id="aworkbook_8h_html_a81d456b4f65a464e78e4a0030ecc3c2e"><div class="ttname"><a href="workbook_8h.html#a81d456b4f65a464e78e4a0030ecc3c2e">workbook_add_worksheet</a></div><div class="ttdeci">lxw_worksheet * workbook_add_worksheet(lxw_workbook *workbook, const char *sheetname)</div><div class="ttdoc">Add a new worksheet to a workbook.</div></div>
<div class="ttc" id="aworkbook_8h_html_a63b001ecefdbc4417986a3e344657726"><div class="ttname"><a href="workbook_8h.html#a63b001ecefdbc4417986a3e344657726">workbook_add_chart</a></div><div class="ttdeci">lxw_chart * workbook_add_chart(lxw_workbook *workbook, uint8_t chart_type)</div><div class="ttdoc">Create a new chart to be added to a worksheet:</div></div>
<div class="ttc" id="astructlxw__doc__properties_html"><div class="ttname"><a href="structlxw__doc__properties.html">lxw_doc_properties</a></div><div class="ttdef"><b>Definition:</b> workbook.h:183</div></div>
<div class="ttc" id="aworkbook_8h_html_a337caad1c1cb16fed505a180d77f20d3"><div class="ttname"><a href="workbook_8h.html#a337caad1c1cb16fed505a180d77f20d3">workbook_set_custom_property_string</a></div><div class="ttdeci">lxw_error workbook_set_custom_property_string(lxw_workbook *workbook, const char *name, const char *value)</div><div class="ttdoc">Set a custom document text property.</div></div>
<div class="ttc" id="aworkbook_8h_html_a279a5d7075d09a3931aae9782afede33"><div class="ttname"><a href="workbook_8h.html#a279a5d7075d09a3931aae9782afede33">workbook_add_format</a></div><div class="ttdeci">lxw_format * workbook_add_format(lxw_workbook *workbook)</div><div class="ttdoc">Create a new Format object to formats cells in worksheets.</div></div>
<div class="ttc" id="achart_8h_html_a9f577b0fcabe6cac9118a26a483fe85cafa7f69bde9c99b5818297c64e8b9070a"><div class="ttname"><a href="chart_8h.html#a9f577b0fcabe6cac9118a26a483fe85cafa7f69bde9c99b5818297c64e8b9070a">LXW_CHART_COLUMN</a></div><div class="ttdeci">@ LXW_CHART_COLUMN</div><div class="ttdef"><b>Definition:</b> chart.h:113</div></div>
<!-- HTML footer for doxygen 1.8.20-->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Copyright 2014-2020 John McNamara.
Generated by&#160;<a href="http://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.8.20
</small></address>
</body>
</html>
